Android Question Firebase FCM Missing Registration Error

VictorTandil

Member
Licensed User
Longtime User
Good morning. I have two questions about the FCM service.

1) What is the line of code that registers the user on the FCM server?

Would it be next?
B4X:
Fm.Initialize ("fm")

In that case, every time the App goes to "Resume" should I initialize it again?

On some occasions (not always) I get the error when sending a message that says "MissingRegistration".

2) Does the API_KEY change from time to time?

Approximately every two weeks, the key in the console changes without warning, which blocks users to send messages. This is normal?
 

DonManfred

Expert
Licensed User
Longtime User
Based on the Firebase tutorial this line is in the firebaseMessaging service which, itself, is started from the starter service.
So, you dont need to do anything more than to start your app. Everytime you start the app, a token will be aquired. It may be the same token for days/weeks.
But it can happen that it changes! There is a event for this...

So, in your subscribetotopics you can call a server app on your server to give the token to your server. The server itself stores the token in a database or whatever.

Use the values stored in your server to send pushes.
 
Upvote 0
Top