Xamarin Forms: Token generating is not working when taking the update

Sreejith Sree 1,251 Reputation points
2021-11-08T13:11:47.057+00:00

I have implemented the push notification feature for my xamarin forms project (both android and ios). The token registration class FirebaseRegistrationService is working only on the fresh installation. When taking updates this class is not firing and no token is generating. As per this blog, OnTokenRefresh is invoked infrequently: it is used to update the token under the following circumstances:

  • When the app is installed or uninstalled.
  • When the user deletes app data.
  • When the app erases the Instance ID.
  • When the security of the token has been compromised.

My problem is my app is already LIVE on the play store without the push notification. We have implemented the push notification now and planning to update it on play stores. But if the user takes the update the FCM registration will not work for them and they are not going to receive any notification. Existing users need to uninstall the app and install it again for getting the notifications. Is there any solution for this?

But on the ios part, the DidReceiveRegistrationToken is invoking when taking updates, and no such token issue on the ios part.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,291 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,016 Reputation points Microsoft Vendor
    2021-11-09T06:23:17.523+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Normally, we will store the token in the Xamarin.Essentials: Secure Storage on the fresh installation. After updating application, you still get the token from the local secure storage. But now, If you do not store the token in the local storage, existing users have to uninstall the app or delete app data.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful