firebase / firebase-admin-dotnet

Firebase Admin .NET SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
357 stars 129 forks source link

APS notification #316

Closed newbie1992 closed 2 years ago

newbie1992 commented 2 years ago

If trying to send a notification with an image, it does not show the image on the notification on iOS. I am using the code below.

var app = GetFirebaseApp(credential);
var firebaseMsg = messages.Select(message => new FirebaseAdmin.Messaging.Message() {
                Notification = new FirebaseAdmin.Messaging.Notification() {
                Title = message.Subject,
                Body = message.Body,
                ImageUrl = message.Image,
            },
            Apns = new FirebaseAdmin.Messaging.ApnsConfig {
                Aps = new FirebaseAdmin.Messaging.Aps
                {
                    MutableContent = true,
                    ContentAvailable =true,
                },
                FcmOptions = new FirebaseAdmin.Messaging.ApnsFcmOptions
                {
                    ImageUrl = message.Image
                }
            },
            Token = message.Receiver.Address,
        });
var response = await FirebaseAdmin.Messaging.FirebaseMessaging
            .GetMessaging(app)
            .SendAllAsync(firebaseMsg);

I saw firebase rich push notification payload for ios which is needed to rename the mutable-content to mutable_content and content-available to content_available. Is there any solution that I am able to rename JSON property mutable-content and content-available?

google-oss-bot commented 2 years ago

I found a few problems with this issue:

lahirumaramba commented 2 years ago

What does your image url look like? I think the image url should be a complete and a valid url.

According to the docs, mutable-content should work. See Payload Key Reference.

Please use Stack Overflow for usage questions in the future. Thanks!