diff --git a/README.md b/README.md index 44cbf4f1aff630389ee0b91d4ac1d74d0034906a..7f6d7396c0e45a4c1862dd4bb74e3e7acad6a180 100644 --- a/README.md +++ b/README.md @@ -119,13 +119,15 @@ var FCM = require('react-native-fcm'); componentWillMount() { FCM.requestPermissions(); -FCM.getFCMToken().then(token => { +FCM.getFCMToken().then(data => { + console.log(data.token) //store fcm token in your server }); this.fcmNotifLsnr = DeviceEventEmitter.addListener('FCMNotificationReceived', (notif) => { //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 }); }