diff --git a/notify/notification_fcm.go b/notify/notification_fcm.go index a34e94e7..58dff083 100644 --- a/notify/notification_fcm.go +++ b/notify/notification_fcm.go @@ -74,21 +74,23 @@ func GetAndroidNotification(req *PushNotification) []*messaging.Message { } // Check if the notification has a sound - if req.Sound != "" { - if req.APNS == nil { + if req.Sound != nil { + sound, ok := req.Sound.(string) + + if req.APNS == nil && ok { req.APNS = &messaging.APNSConfig{ Payload: &messaging.APNSPayload{ Aps: &messaging.Aps{ - Sound: req.Sound.(string), + Sound: sound, }, }, } } - if req.Android == nil { + if req.Android == nil && ok { req.Android = &messaging.AndroidConfig{ Notification: &messaging.AndroidNotification{ - Sound: req.Sound.(string), + Sound: sound, }, } }