I just did an upgrade to all my Firebase dependencies and I have an issue, FirebaseInstanceId
is not recognized anymore. I have used it to get the token id like this:
String tokenId = FirebaseInstanceId.getInstance().getToken();
This is the error:
Cannot resolve symbol 'FirebaseInstanceId'
Here is my build.gradle file:
//Firebase
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.1'
//FirebaseUI
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
implementation 'com.firebaseui:firebase-ui-database:4.0.0'
implementation 'com.firebaseui:firebase-ui-firestore:4.0.0'
How can I get the token id using the latest dependencies?
I also faced the same problem. From the doc, it says FirebaseInstanceId is no longer available and says to use FirebaseMessaging.getInstance().token as below
FirebaseMessaging.getInstance().token.addOnCompleteListener(OnCompleteListener { task ->
if (!task.isSuccessful) {
Log.w(TAG, "Fetching FCM registration token failed", task.exception)
return@OnCompleteListener
}
// Get new FCM registration token
val token = task.result
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With