Open
Description
Hello.
I'm having issues getting sound for the notifciations sent to IOS Devices. The devices receives the notification but without sound.
func buildIOSMessage() *messaging.Message {
tokenDecrypted, err := decrypt(iosToken)
if err != nil {
log.Fatal("fatal decrypt")
}
// Prepare IOS message
message := &messaging.Message{
Token: tokenDecrypted,
Notification: &messaging.Notification{
Title: "whatever",
Body: "body"
},
APNS: &messaging.APNSConfig{
Headers: map[string]string{
"apns-priority": "10", // High priority
},
Payload: &messaging.APNSPayload{
Aps: &messaging.Aps{
Alert: &messaging.ApsAlert{
Title: "whatever"
Body: "body"
},
Sound: "default",
},
CustomData: map[string]interface{}{
"extra_super_data": "whatever",
},
},
},
}
return message
}
client, err := app.Messaging(ctx)
res, err := client.Send(ctx, message)
if err != nil {
log.Fatalf("Failed to sent message: %v", err)
}
log.Println(res)
log.Println("Firebase messaging client created successfully")
However, if I sent it through Firebase console, it works. If we compare the payload received in both cases:
- Not working
{
"gcm.message_id": "whatever",
"google.c.a.e": "1",
"google.c.sender.id": "whatever",
"aps": {
"alert": {
"title": "quefacemos",
"body": "SONIDOSONIDOSONIDO"
}
},
"google.c.fid": "whatever",
"extra_super_data": "whatever"
}
- Firebase console message - working
{
"google.c.a.c_l": "Test sound",
"google.c.a.c_id": "whatver",
"google.c.sender.id": "whatever",
"google.c.a.ts": "whatv",
"gcm.n.e": "1",
"gcm.message_id": "whatever",
"google.c.a.e": "1",
"google.c.fid": "whatever",
"aps": {
"alert": "Test sound",
"sound": "default",
"mutable-content": 1
},
"google.c.a.udt": "0",
"gcm.notification.sound2": "default"
}
Anyone could help me? Thanks
Metadata
Metadata
Assignees
Labels
No labels