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 ?
Asked
Active
Viewed 3,275 times
0
-
check this https://github.com/SeuJota/react-native-device-token – Pramendra Gupta Oct 04 '17 at 06:27
-
Sorry.. so how do i retrieve this generated token?I mean do i need to write any extra code in native? – Neethu M Oct 04 '17 at 06:45
1 Answers
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