question

Kim Strasser avatar image
Kim Strasser asked

Push notifications not working after updating Android version from 11 to 12

I have downloaded my game from Google Play Console and installed it on my Samsung tablet with Android version 11. PlayFabClientAPI.AndroidDevicePushNotificationRegistrationAsync was executed and the Android device identifier was stored in the player's Title Data.

I use this code to get the Android device identifier:

if (Device.RuntimePlatform == Device.Android)
    deviceID = Android.Provider.Settings.Secure.GetString(Android.App.Application.Context.ContentResolver, Android.Provider.Settings.Secure.AndroidId);

The player's Title Data:

{"DeviceAndroid":"d680f159038cb73f","DeviceIos":""}

At this moment the push notifications worked.

After that, I uninstalled my game on the Samsung tablet and I installed Android version 12 on the device.

Then I downloaded and installed my game again on the device but AndroidDevicePushNotificationRegistrationAsync was not executed because the player already had the same device identifier stored in Title Data and therefore push notifications didn't worked.

I get this error message on Android when I use the Send push notification button in the title player account overview: Failed to deliver to mobile device. Check that the device is registered for push notifications. Error: Android Push Notification Failed: Client has been unregistered for push notifications.

I needed to delete the device identifier manually in the player's Title Data in order that AndroidDevicePushNotificationRegistrationAsync could be called again in my game. After that, push notifications worked again.

The player's new device identifier in Title Data is the same:

{"DeviceAndroid":"d680f159038cb73f","DeviceIos":""}

In my game I check if the player's device identifier is different than the device identifier stored in Title Data. If it is different, then I call AndroidDevicePushNotificationRegistrationAsync and I store the new device identifier in the player's Title Data. But in this case, the device identifier was always the same but push notifications didn't worked after updating Android version from 11 to 12.

How can I find out if I need to call AndroidDevicePushNotificationRegistrationAsync again after the player has updated his Android version?

Push Notifications
10 |1200

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

1 Answer

·
Seth Du avatar image
Seth Du answered

Would you try another device to register and replace the previous push notification device id, then switch back to the original Android 12 device?

For now, directly unregistering devices for push notification are not supported. Please feel free to send a thread on the Feature Requests forum -- https://community.playfab.com/spaces/24/index.html

3 comments
10 |1200

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

Kim Strasser avatar image Kim Strasser commented ·

I found out that the problem is not related to the update to Android 12. I have deleted the device identifier in the player's Title Data. After that, I installed my game on the Samsung tablet. Then, Title Data looks like this and push notification works because AndroidDevicePushNotificationRegistration was executed: {"...":"d680f159038cb73f"}

After that, I uninstalled my game and I installed it again on the same Samsung tablet. Then, push notifications are not working because AndroidDevicePushNotificationRegistration was not executed because the player already has the same device identifier stored in Title Data.

After that, I installed my game on another Android device and then push notifications work on this device because AndroidDevicePushNotificationRegistration is executed and Title Data gets updated with the new device identifier: {"...":"eb4b63781240f3f0"}

Finally, I installed my game again on the Samsung tablet and then push notifications work again on this device because AndroidDevicePushNotificationRegistration is executed and Title Data gets updated with the new device identifier.

How can I find out if I need to call AndroidDevicePushNotificationRegistration on Android?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Kim Strasser commented ·

Currently it is not supported to detect the client's state. Besides sending a feature request to us, you can also provide a report channel for players so that those with push issue can send an email to the administrator of your game for a manual fix.

0 Likes 0 ·
Kim Strasser avatar image Kim Strasser Seth Du ♦ commented ·

It works now. I store the player's PlayFabId now in a file on the device after PushNotificationRegistration was called successfully. When the player logs in again with the same PlayFabId, then I don't call PushNotificationRegistration again. But if he logs in with another PlayFabId on this device, then I call PushNotificationRegistration and I replace the old PlayFabId with the new PlayFabId in the file. In addition, this works if the player uninstalls my game and installs it again on the same device because the file gets deleted when the player uninstalls my game.

0 Likes 0 ·

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.