MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.26k stars 21.43k forks source link

Migration to FCM V1 issues - how to migrate (update) existing installations to FCM V1? #122561

Closed laki889 closed 5 months ago

laki889 commented 5 months ago

I'm migrating from FCM to FCM V1. In that process, I'm following the official docs: https://learn.microsoft.com/en-us/azure/notification-hubs/firebase-migration-sdk

In our system, we have 2 endpoints created on the BE - for registering and unregistering a device from Azure Notifications Hub. Installations are used (instead of registrations) for registering new devices.

I have a problem with step number 3 (3. Manage registrations and installations) from the official docs. I'm trying to update existing installations by going through all registrations, getting installation for each appropriate registration, and updating the Platform property to the value of NotificationPlatform.FcmV1. This doesn't work at all. I created a method to query how many devices there are for each platform, and the numbers are the same before and after the update to FCM V1.

Does anybody else have a similar problem?


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

PesalaPavan commented 5 months ago

@laki889 Thanks for your feedback! We will investigate and update as appropriate.

laki889 commented 5 months ago

Update for the people that could face the same problem. I figured out the root cause of the issue. On the project I'm working on, we register devices on the BE side (not inside the mobile app). There is an endpoint that accepts payload with the following data:

The issue was with the values of InstallationId and Handle—they were the same, which is the problem for FCM V1 installations (the same thing was not the problem for FCM installations). Our mobile app will get the device token (Handle) from Apple or Google and set that value for the InstallationId. So, when the BE registration endpoint is hit, we get the same value (same string) for both InstallationId and Handle. This worked for FMC. But it doesn't for FCMV1. The solution was to use the different values for InstallationId and Handle. After changing this part, the method CreateOrUpdateInstallation was executed as expected, and new devices were added to the Azure Notifications Hub list of devices.

You can close this ticket if you ask me.