question

Mohsen Jamali avatar image
Mohsen Jamali asked

Obsolete code for iOS push notification

Hi

The code example for getting token and registering iOS push notification in here


https://docs.microsoft.com/en-us/gaming/playfab/features/engagement/push-notifications/push-notifications-for-ios

is obsolete. Can you provide the code for the newest mobile notification?

Specifically this part

UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound, true);

byte[] token = UnityEngine.iOS.NotificationServices.deviceToken;

if(token != null) { RegisterForIOSPushNotificationRequest request = new RegisterForIOSPushNotificationRequest(); request.DeviceToken = System.BitConverter.ToString(token).Replace("-", "").ToLower(); PlayFabClientAPI.RegisterForIOSPushNotification(request, (RegisterForIOSPushNotificationResult result) => { Debug.Log("Push Registration Successful"); }, OnPlayFabError); } else { Debug.Log("Push Token was null!"); }

Push Notifications
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image Sarah Zhang commented ·

After researching, we found the code provided by our PlayFab Unity SDK can work fine, but the following push notification service provided by Unity natively is obsolete, is it right?

UnityEngine.iOS.NotificationServices

If so, could you please also clarify which one Unity version you are using?

0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.