Commit 5ee12933 authored by Libin Lu's avatar Libin Lu

fix readme for get token callback

parent 9e1e4950
...@@ -119,13 +119,15 @@ var FCM = require('react-native-fcm'); ...@@ -119,13 +119,15 @@ var FCM = require('react-native-fcm');
componentWillMount() { componentWillMount() {
FCM.requestPermissions(); FCM.requestPermissions();
FCM.getFCMToken().then(token => { FCM.getFCMToken().then(data => {
console.log(data.token)
//store fcm token in your server //store fcm token in your server
}); });
this.fcmNotifLsnr = DeviceEventEmitter.addListener('FCMNotificationReceived', (notif) => { this.fcmNotifLsnr = DeviceEventEmitter.addListener('FCMNotificationReceived', (notif) => {
//there are two parts of notif. notif.notification contains the notification payload, notif.data contains data payload //there are two parts of notif. notif.notification contains the notification payload, notif.data contains data payload
}); });
this.fcmTokenLsnr = DeviceEventEmitter.addListener('FCMTokenRefreshed', (token) => { this.fcmTokenLsnr = DeviceEventEmitter.addListener('FCMTokenRefreshed', (data) => {
console.log(data.token)
//fcm token may not be available on first load, catch it here //fcm token may not be available on first load, catch it here
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment