JavaForAndroid
JavaForAndroid

Reputation: 1179

Firebase OnTokenRefresh() never called?

I have a problem with Firebase Cloud Messaging. The message onTokenRefresh is not called in my Android App. It worked some time before but now I do not get a new token.

My Code:

public class FirebaseIDService extends FirebaseInstanceIdService {
@Override
public void onTokenRefresh() {
    Log.e("Token refresh","Method called");
}
}

I initiate the method call by String fcm_token = FirebaseInstanceId.getInstance().getToken(); The String is null, perhaps because FCM works asynchronously.

My Manifest:

<service
  android:name=".FirebaseIDService">
  <intent-filter>
    <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
  </intent-filter>
</service>

Do you have any idea what is wrong? I also tried FirebaseInstanceId.getInstance().deleteInstanceId(); before. It causes a timeout.

Upvotes: 0

Views: 953

Answers (1)

Deividas Strioga
Deividas Strioga

Reputation: 1467

Update your dependencies to com.google.firebase:firebase-core:11.0.4 com.google.firebase:firebase-messaging:11.0.4.

Upvotes: 1

Related Questions