4

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" : {
    ...
  },
}
Aleksandar G
  • 1,163
  • 2
  • 20
  • 25
Hamza Boularbah
  • 110
  • 1
  • 11
  • 1
    Possible duplicate of [What is FCM token in Firebase?](http://stackoverflow.com/questions/37671380/what-is-fcm-token-in-firebase) – AL. Apr 19 '17 at 12:32
  • I guess the Firebase crew isn't answering questions anymore. I also have this question. The documentation is inadequate. – rm.rf.etc Aug 31 '17 at 18:20

1 Answers1

0

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);
Aleksandar G
  • 1,163
  • 2
  • 20
  • 25