6

I`ve created application for Android Wear watch. And now have one device in Russia (Ulyanovsk city) and one in Canada (Toronto city). Any Google Play Services settings and versions are the same for both devices. But there are no problems in Russian with getting FirebaseInstanceId token, and "FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE" exception in Canada.

Devices: - Ticwatch E, Wear OS Google 1.01-1.3, Google Play Services 12.6.85, OS Android 7.1-8.0

FCMRegistrationIntentService is my class that extends FirebaseInstanceIdService is declarated in Android Manifest:

<service
    android:name=".gcm.FCMRegistrationIntentService"
    android:permission="false">
    <intent-filter>
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
    </intent-filter>
 </service>

FCMRegistrationIntentService:

public class FCMRegistrationIntentService extends FirebaseInstanceIdService {
    @Override
    public void onTokenRefresh() {
        // Get updated InstanceID token.
        String refreshedToken = FirebaseInstanceId.getInstance().getToken();
    }

    private void sendRegistrationToServer(String token) {
        // TODO: Implement this method to send token to your app server.
    }
}

And calling for token in main code with:

FirebaseInstanceId.getInstance().getToken();

that returns correct token in Russian and null in Canada (because initially "FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE")

Samir Alyasov
  • 61
  • 1
  • 3
  • Does this answer your question? [FirebaseInstanceId Token retrieval failed SERVICE\_NOT\_AVAILABLE](https://stackoverflow.com/questions/49949818/firebaseinstanceid-token-retrieval-failed-service-not-available) – Stephan Jul 20 '20 at 18:08

0 Answers0