Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FCM Token retrieval failed RST

I'm doing a GCM to FCM Migration for my app. But when testing my final code on a device I get the following error in my Logcat and the call to Firebase fails.

E/FirebaseInstanceId: Token retrieval failed: RST

There is no information in the Firebase docs what "RST" means etc..

Who can help me out?

EDIT

enter image description here enter image description here

like image 648
Dennis Anderson Avatar asked May 18 '18 09:05

Dennis Anderson


People also ask

How long FCM Token expired?

It doesn't expire though. It renews itself if one of the following happens. According to https://firebase.google.com/docs/cloud-messaging/android/client: -The app deletes Instance ID.

How do I get FCM device token for web?

Access the registration token FCM requires a firebase-messaging-sw.js file. Unless you already have a firebase-messaging-sw.js file, create an empty file with that name and place it in the root of your domain before retrieving a token. You can add meaningful content to the file later in the client setup process.


1 Answers

Just try using

FirebaseInstanceId.getInstance().getToken()

And also add

FirebaseOptions.Builder().setGcmSenderId("YOUR_SENDER_ID")

before calling the getToken Method.. Hope it helps

like image 134
Harsh Agrawal Avatar answered Sep 30 '22 04:09

Harsh Agrawal