Ionic extract the registration id


#1

Hi everyone, I have a problem with notifications. I want to extract from my application its “registration id” someone knows how to do it? I found so many solutions that suggested installing the PushNotification plugin ( ng-cordova) but is it deprecating someone has any alternatives? Thanks a lot for the answer.
I’m sorry for my english


#2

What did you use to implement push in your application? Getting the “registration id” or “device token” is dependent on the library you are using.


#3

I’m using firebase to send notifications to my device by installing cordova-plugin-firebase.
But I want to make dynamic notifications and to do this I use the registration id to send to a remote service. Can anyone put an example code?


#4

This one: https://github.com/arnesson/cordova-plugin-firebase ?
No other plugins or Ionic Native plugins installed?

This looks good:
https://github.com/arnesson/cordova-plugin-firebase#gettoken
https://github.com/arnesson/cordova-plugin-firebase#ontokenrefresh


#5

Thanks a lot but it is normal that the browser gives an error?


#6

If by browser you mean ionic serve, then yes. Cordova plugins are only available on devices of the installed Cordova platform.


#7

Does not work. When I open the application on the emulator I want to make a alert with the token written. How should I do it