4
votes

Firebase allows us to send notification messages via our own application by making POST request.

This tutorial gives instructions how to make this request. However, there is a "to" field in the JSON, where I must place a Registration key.

Where can I get this Registration key? There are no instructions for this.

Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

{
  "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
  "data" : {
    ...
  },
}
1
Possible duplicate of What is FCM token in Firebase? - AL.
I guess the Firebase crew isn't answering questions anymore. I also have this question. The documentation is inadequate. - rm.rf.etc

1 Answers

0
votes

To get a token, call FirebaseInstanceId.getInstance().getToken();. After that step, in order to see the token, just make an output to Logcat

Code example:

String token = FirebaseInstanceId.getInstance().getToken();
Log.i("MainActivity", "Token: " + token);