0

How do i get the device token when a user is registered in an app.The purpose is that i want to send push notification using fcm. Can anybody please help ?

Neethu M
  • 133
  • 7
  • 20

1 Answers1

0

When I did kinda the same thing I went with this lib: https://github.com/evollu/react-native-fcm

Which I think works great btw.

When the user clicks on the register button or whatever, I do:

FCM.getFCMToken().then(token => {
    //Send register request
});

The token can change as well, so whenever the app is started I compare the existing key from AsyncStorage and if it has changed I'll use the same procedure to update the key backend.

Hope this helps, good luck.

LanfeaR
  • 241
  • 1
  • 8