From 74715e857070d77b39d1559ffa0a1e3b239fd1c9 Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Tue, 26 Sep 2017 09:18:57 -0400 Subject: [PATCH] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a79305..8fce0d2 100644 --- a/README.md +++ b/README.md @@ -323,8 +323,11 @@ class App extends Component { }); this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => { - // do some component related stuff + // optional, do some component related stuff }); + + // sometimes android kills activity when app goes to background, and when resume it broadcasts notification before JS is run. You can use FCM.getInitialNotification() to capture those missed events. + FCM.getInitialNotification().then(notif=>console.log(notif)); } componentWillUnmount() { @@ -336,7 +339,6 @@ class App extends Component { FCM.subscribeToTopic('/topics/foo-bar'); FCM.unsubscribeFromTopic('/topics/foo-bar'); - FCM.getInitialNotification().then(notif=>console.log(notif)); FCM.presentLocalNotification({ id: "UNIQ_ID_STRING", // (optional for instant notification) title: "My Notification Title", // as FCM payload -- 2.26.2