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

How to getdevice token ID from RegisteredForRemoteNotifications

$
0
0

Hey
I need to get the device token id when my IOS application start.
the bellow RegisteredForRemoteNotifications is running in the APPdelegate.cs and i am getting the NSData devicetoken. But how to extract the Device Token ID that i can use to push notification to that device. (like s.token in the second script)

public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
                {
                    string str = deviceToken.Description;
                    FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken);

        //trying here to extract the token id from devicetoken. I need to save it to my database with no result
        //var tokenStringBase64 = deviceToken.GetBase64EncodedString(NSDataBase64EncodingOptions.None);
                   // NSString nstoken = NSString.FromData(deviceToken, NSStringEncoding.UTF8);
                    //String token = nstoken.ToString();
                    //String aa = (String)deviceToken;
                    //var deviceTokenString = deviceToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");
                }

If i go to Firebase console and send notification to all IOS application i can found this token ID from **s.token **in the bellow script

    CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
                        {System.Diagnostics.Debug.WriteLine(s.token);};

i spent 4 to 5 hours and i didnt arrive to get it..


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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