Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Firebase notifications: messaging:didReceiveRegistrationToken is not being called.

$
0
0

I have an Xamarin.iOS app and I've recently updated my Xamarin.Firebase.iOS.CloudMessaging package from 1.2.2 to 4.1.1.1. Once I did this update and added the relevant code changes, I've stopped receiving notifications in my app. When I started debugging it I've realized DidReceiveRegistrationToken is never getting called.

Here's my code:

        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Firebase.Core.App.Configure();

            if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))       // I don't care about iOS < 10
            {
                UNUserNotificationCenter.Current.Delegate = this;
                Messaging.SharedInstance.Delegate = this;

                var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound;
                UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) =>
                {
                    Console.WriteLine("Notification authorization granted: " + granted);
                });
            }

            UIApplication.SharedApplication.RegisterForRemoteNotifications();
    }

        [Export("messaging:didReceiveRegistrationToken")]
        public void DidReceiveRegistrationToken(string token)
        {
            Console.WriteLine("Token!! " + token);
            //do something with token,
        }

Any ideas what am I doing wrong?
I'm using:
Xamarin.Firebase.iOS.CloudMessaging 4.1.1.1
Xamarin.Firebase.iOS.InstanceID 4.2.1
Xamarin.Firebase.iOS.Core 6.1.0
Which are all currently up to date.

Thanks!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>