React-native-push-notification: fetch token for Android and iOS

Created on 10 Nov 2016  路  4Comments  路  Source: zo0r/react-native-push-notification

I have specified the PushNotification configuration as above, but i'm not able to fetch the device token.

As far as I know, the onRegister should be fired. I would like to get the token, for server purpose and remote push notifications through GCM.

componentDidMount() {
PushNotification.configure({
onRegister: function(token) {
console.log( 'TOKEN:', token );
},
onNotification: function(notification) {
console.log( 'NOTIFICATION:', notification );
},
});
}

Most helpful comment

I'm going to start putting together a trouble shooting guide i think. We keep getting the same questions over and over.

All 4 comments

you need to setup senderID, this is the project number in your FB console, and run in a real device or use gennymotion but flash GAPS

I'm going to start putting together a trouble shooting guide i think. We keep getting the same questions over and over.

Okay, I'm using full configuration, with correct senderID, but didnt try a real device.

Can verify that with real device(android v. 5.1.1), correct senderID, I can fetch the token. :) Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Benzer1406 picture Benzer1406  路  3Comments

atteia picture atteia  路  4Comments

NiuQiaoling picture NiuQiaoling  路  3Comments

nguyenvanphuc2203 picture nguyenvanphuc2203  路  3Comments

ssolida picture ssolida  路  3Comments