How to set registration_id in pyfcm

2.1k Views Asked by At

So I have project with push notification, I have app build with Ionic (Client - receive notification) and I have server to push the notification with pyfcm.

In pyfcm, how to get registration_id ? I try dummy the registration_id then the response is :

{'failure': 1, 'canonical_ids': 0, 'success': 0, 'multicast_id': 5299463400095790981L, 'results': [{u'error': u'InvalidRegistration'}]}

I have some tutorial from here https://github.com/olucurious/PyFCM and here https://medium.com/@ankushaggarwal/push-notifications-in-ionic-2-658461108c59 and there is code called :

pushObject.on('registration').subscribe((data: any) => {
  console.log("device token ->", data.registrationId);
});

how can I retrieve the registration Id ?

Any help will appreciate..

1

There are 1 best solutions below

2
On

The registration_id being referred to here is referring to a Registration token:

An ID generated by the FCM SDK for each client app instance. Required for single device and device group messaging. Note that registration tokens must be kept secret.

Depending on your client (which is Android) it should be generated upon the initial start of your client app. See Setup an Android Client for more details. Also see What is FCM token in Firebase?