Search code examples
androidandroid-studiofirebasepush-notificationfirebase-console

Invalid Firebase Registration Token


Im trying to send push notifications with firebase, and i actually receive my token, but i cannot sent a simple message from the firebase console.

This is what my token looks like: dRAlEiZYCSE:APA91bFfkyAi7qzzLoifd7x9WeayghNlpSchhCvYHCnqSVkOJpkWuDuWHxL9t2-nb_TN_1J6MyKBsfCHg7vbhCun

i added this to my manifest file:

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

And this here its from my firebaseInstanceIdService java file

public class FirebaseInstanceIDService extends FirebaseInstanceIdService{

    @Override
    public void onTokenRefresh() {

        MainActivity.tokenMain = FirebaseInstanceId.getInstance().getToken();
        Log.d("test", FirebaseInstanceId.getInstance().getToken());
    }
}

I get the token, but when i try to use it in the console, i get WRONG TOKEN FORMAT


Solution

  • The issue was that my token was saved in varChar 100, which was simply too short. (token was cut off in the middle)