diff --git a/Examples/firebase-migration/app/App.js b/Examples/firebase-migration/app/App.js
index d831bcad2000bd85737ceccff043c110a3451d4e..74b70d552383b13c395af80c6a6a6ddf8263317c 100644
--- a/Examples/firebase-migration/app/App.js
+++ b/Examples/firebase-migration/app/App.js
@@ -73,6 +73,16 @@ class MainPage extends Component {
// topic example
firebase.messaging().subscribeToTopic('sometopic');
firebase.messaging().unsubscribeFromTopic('sometopic');
+
+ AsyncStorage.getItem('lastNotification').then(data=>{
+ if(data){
+ // if notification arrives when app is killed, it should still be logged here
+ this.setState({
+ offlineNotif: JSON.parse(data)
+ });
+ AsyncStorage.removeItem('lastNotification');
+ }
+ })
}
componentWillUnmount(){
@@ -192,7 +202,14 @@ class MainPage extends Component {
Init notif:
- {JSON.stringify(this.state.initNotif && this.state.initNotif.data)}
+ {JSON.stringify(this.state.initNotif)}
+
+
+
+ Notif when app was closed:
+
+
+ {JSON.stringify(this.state.offlineNotif)}
diff --git a/Examples/firebase-migration/app/Listeners.js b/Examples/firebase-migration/app/Listeners.js
index eba580531ea9b71fdb60044297fe370284041868..c13f8f3e366b56c4efe94a1a60060e6adf6938ea 100644
--- a/Examples/firebase-migration/app/Listeners.js
+++ b/Examples/firebase-migration/app/Listeners.js
@@ -2,14 +2,6 @@ import { Platform, AsyncStorage, AppState } from 'react-native';
import firebase from 'react-native-firebase';
-AsyncStorage.getItem('lastNotification').then(data=>{
- if(data){
- // if notification arrives when app is killed, it should still be logged here
- console.log('last notification', JSON.parse(data));
- AsyncStorage.removeItem('lastNotification');
- }
-})
-
function displayNotificationFromCustomData(message: RemoteMessage){
if(message.data && message.data.custom_notification){
let notification = new firebase.notifications.Notification();
@@ -24,7 +16,7 @@ function displayNotificationFromCustomData(message: RemoteMessage){
}
export function registerKilledListener(message: RemoteMessage){
- AsyncStorage.setItem('lastNotification', JSON.stringify(message));
+ AsyncStorage.setItem('lastNotification', JSON.stringify(message.data));
displayNotificationFromCustomData();
}
diff --git a/Examples/firebase-migration/ios/SimpleFcmClient.xcodeproj/xcshareddata/xcschemes/SimpleFcmClient.xcscheme b/Examples/firebase-migration/ios/SimpleFcmClient.xcodeproj/xcshareddata/xcschemes/SimpleFcmClient.xcscheme
index 8432ca92e95c98f9968615a30d7f8c2c76a65702..5f74c52d9416acdb85d93ae5e524be40596b5467 100644
--- a/Examples/firebase-migration/ios/SimpleFcmClient.xcodeproj/xcshareddata/xcschemes/SimpleFcmClient.xcscheme
+++ b/Examples/firebase-migration/ios/SimpleFcmClient.xcodeproj/xcshareddata/xcschemes/SimpleFcmClient.xcscheme
@@ -54,7 +54,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- language = ""
shouldUseLaunchSchemeArgsEnv = "YES">