I do not know whether I should ask all three questions in 1 "topic", but I will try.

1) How many FCM tokens are generated? In the current application, getting the FCM token is a prerequisite for its work, so at the very beginning I try to get it with the command

String fcmToken = FirebaseInstanceId.getInstance().getToken(); 

First but It takes some time to generate it (as they say in foreign sources - “usually less than 10 seconds, depending on the Internet, device load, etc.”). Thus, I will have to start a thread that will check the presence of a token every N seconds and if it is received, then continue the application, which seems to me ... well, wrong, although I do not see any other way.

By the way, as I said, the application cannot work without it, therefore I would like to know if it can be replaced with something in the absence (except for a permanent connection to the server).

2) When is it impossible to receive it? Second but To create it, there are several conditions known to me - the presence on the device google-play-services, as well as Internet connections. Is this a final list or are there any other dependencies / conditions?

3) When does it reissue? The function responsible for obtaining a token in the service is called

 @Override public void onTokenRefresh() {} 

The name of the function hints, to put it mildly, that a new FCM can be issued (and why even a whole service for getting a token, FirebaseInstanceIdService). When can this happen? Perhaps the function name misleads me?

  • when the application is removed, the token changes - zayn1991

0