Open Estebank94 opened 3 years ago
+1
Any workaround?
I didn't find one yet...
Same problem :(
@Estebank94 Are you opening the notification through an action on the notification or just by tapping the notification?
Also, what do you mean the notification should be handled? By what?
@ninjz do you know how I can handle an action when the app is killed, or is it not possible? Since the event listener is removed
@joaocosta9 Two things:
react-native-splash-screen
as that ends up swallowing some events which prevents you from receiving the callbacks on the delegate. (This was a huge breakthrough for me which took days to figure out)getInitialNotification()
always returns null. Store the notification action response in didReceiveNotification
callback inside of AsyncStorage and retrieve that on app launch. Also, delay the call of the callback inside of didReceiveNotification
to make sure there is enough time to handle everything you need to process the notification action.For me, the biggest issue now is getting this to work with the Watch. Can't seem to consistently get the notification action response from it when the app has been backgrounded for some time (> ~30mins). Still investigating this issue and my guess so far is that it's due to some other dependency.
Hey @ninjz , thanks for your response. You are talking about the didReceiveNotificationResponse in the AppDelegate.m file correct?
@joaocosta9 Yes, if you set the AppDelegate as the delegate for the UNUserNotificationCenter.currentNotificationCenter
I would really appreciate if somebody could share the code on how to store the didReceiveNotification response in the AsyncStorage
@cuttlas me too, I tried to find a way to do that, but I could not find one. Im sorry @ninjz, is there any way you can help us with this ? 😅
@joaocosta9 Two things:
- Make sure you're not using
react-native-splash-screen
as that ends up swallowing some events which prevents you from receiving the callbacks on the delegate. (This was a huge breakthrough for me which took days to figure out)- Since
getInitialNotification()
always returns null. Store the notification action response indidReceiveNotification
callback inside of AsyncStorage and retrieve that on app launch. Also, delay the call of the callback inside ofdidReceiveNotification
to make sure there is enough time to handle everything you need to process the notification action.For me, the biggest issue now is getting this to work with the Watch. Can't seem to consistently get the notification action response from it when the app has been backgrounded for some time (> ~30mins). Still investigating this issue and my guess so far is that it's due to some other dependency.
@ninjz do you have any progress with this?
+1
Description
When I open a scheduled notification when the app is killed, the app opens and nothing happens. When I open a scheduled notification when the app is in foreground or background, the notification is handled.
This is the notification data I get when I open the app by tapping on a notification:
I think there must be something wrong with the App Delegate but I followed the instructions and checked with the example provided.
AppDelegate.h
AppDelegate.m
React Native version:
Steps To Reproduce
Expected Results
The notification should be handled