diff --git a/README.md b/README.md index a4769b2778ff03552eb45be2de266f30db307fd8..44cbf4f1aff630389ee0b91d4ac1d74d0034906a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ ## Installation - Run `npm install react-native-fcm --save` -- Run rnpm link +- Run `rnpm link` +Or you can combine 2 commands +- Run `rnpm install react-native-fcm --save` ## Android Configuration @@ -143,7 +145,35 @@ this.fcmTokenLsnr.remove(); - `FCM.initialData` (contains `data` payload if you send together with notification) - When app is running in background - - App will receive notificaton from `FCMNotificationReceived` event when user click on notification + - App will receive notificaton from `FCMNotificationReceived` event when user click on notification. + e.g. fcm payload looks like + ``` + { + "to":"some_device_token", + "content_available": true, + "notification": { + "title": "hello", + "body": "yo", + "click_action": "fcm.ACTION.HELLO" + }, + "data": { + "extra":"juice" + } + } + ``` + and event callback will receive as + ``` + ///Android + { + fcm: {"action": "fcm.ACTION.HELLO"}, + extra: "juice" + } + ///IOS + { + apns: {action_category: "fcm.ACTION.HELLO"}, + extra: "juice" + } + ``` - When app is running in foreground - IOS will receive notification and android **won't** (better not to do anything in foreground for hybrid and send a seprate data message.)