0

I have a code here where I want to use FireBase Admin to send push notifications to IOS and Android. I recieve token, title and body from method.

var message = new FirebaseAdmin.Messaging.Message()
                {
                    Notification = new FirebaseAdmin.Messaging.Notification
                    {
                        Title = title,
                        Body = body
                    },
                    Token = DeviceToken.First(),
                    Apns = new ApnsConfig { Aps = new Aps { ContentAvailable = true, Sound = "default", Category = "test" } },
                    Android = new AndroidConfig { Notification = new AndroidNotification { ClickAction = "test" } }
                };

                var messaging = FirebaseMessaging.DefaultInstance;

                await messaging.SendAsync(message);
kajke123
  • 13
  • 4
  • Have you initialised the SDK as outlined [here](https://firebase.google.com/docs/admin/setup#initialize-sdk)? – lee-m Aug 09 '22 at 09:31
  • @lee-m I have added the certificate, however I want to be able to send notifications to android and IOS. How do I do that ? – kajke123 Aug 09 '22 at 12:06
  • Nothing is obviously wrong with the code you've posted. Are you getting any errors when sending the notification or just not receiving them on the device? – lee-m Aug 09 '22 at 13:17
  • @lee-m I Am not getting notifications on Iphone – kajke123 Aug 09 '22 at 16:36

0 Answers0