Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
Fix the code to demonstrate how to serialize the device token to send…
Browse files Browse the repository at this point in the history
… it to backend server. (#401)
  • Loading branch information
ederbond authored Feb 24, 2023
1 parent c48c4d6 commit 0bc8046
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Notifications/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using UIKit;
using Foundation;
using Example_Notifications.Screens;
Expand Down Expand Up @@ -95,7 +96,12 @@ public override void ReceivedRemoteNotification (UIApplication application, NSDi
/// </summary>
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
{
deviceToken = deviceToken.ToString ();
var bytes = deviceToken.ToArray<byte>();
var hexArray = bytes.Select(b => b.ToString("x2")).ToArray();

//This is the token that you need to send to your backend-server to perform the
//device registration/installation on the backend if you want.
var token = string.Join(string.Empty, hexArray);
}

/// <summary>
Expand Down

0 comments on commit 0bc8046

Please sign in to comment.