evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 681 forks source link

FCM.scheduleLocalNotification not called in killed state #1090

Open Louies89 opened 5 years ago

Louies89 commented 5 years ago

Hi, Its is strange that, I am getting remote notifications and FCM.on(FCMEvent.Notification,(data)=>{}) is getting called in all the three states(foreground,background and killed state) of the app. But in case of FCM.scheduleLocalNotification({...}), the event FCM.on(FCMEvent.Notification,(data)=>{}) is only getting called when in foreground & Background.

As per my debugging, I saw that, when app is in killed state, then LocalBroadcastManager.getInstance(mContext).sendBroadcast(i) is returning false.

So I guess like remote messages, the react context should be created and the event should be fired. As I have lack of knowledge in ReactApplication) getApplication() and getApplicationContext(), I am inable to fix this. Or may be my way of thinking is wrong.

So please let me know is there any hack I have to do to get the local notification event in killed state of the app ?