Reputation: 3756
We're actively developing a push notification SDK and migrating it to FCM system since GCM is deprecated.
SDK gradle file includes the firebase-messaging package and SDK handles all the token registration and message received actions correctly. SDK gets the token from instanceId.getToken(senderid, "fcm")
method and sends it to the cloud side successfully.
The problem occurs while testing the multiple sender id cases. If customer uses its own Firebase implementation(17.1.0+) with default sender id (getting from google-services.json), onNewToken method will trigger twice for both SDK and customer sender IDs interestingly. We expect to get only customer sender id (default one).
How can we understand where token comes from ? from which sender id ?
(We also contacted with Google, but they are unable to help)
Upvotes: 3
Views: 674
Reputation: 37798
The practice I usually go for is to call getToken(senderid, scope)
per each sender as needed. This way, you're sure to get the expected token.
However, if the goal is to get the default one, then there's no need to worry. onNewToken()
will only return the token for the default sender.
Upvotes: 1