Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

Handling notifications when app is closed on Android #81

Closed Return-1 closed 4 years ago

Return-1 commented 5 years ago

On iOS handling notifications that launch the app is relatively straightforward to use

PushNotificationIOS.getInitialNotification().then((notification) => { //bootstrapping logic })

However, what would be the equivalent API to use in this library here on Android? The idea is that one should be able to capture the data the notification is coming with before the app is launched ( whether it exists or not ) so that then the app can appropriately route, bootstrap etc.

I would be grateful if you could point me to the right direction

wfhm commented 5 years ago

Hi @Return-1,

Could you please describe the exact flow you want to achieve? Am I correct that you want to handle the payload of your notification before the app's launcher activity is shown?

Ufosek commented 4 years ago

@wfhm I think that @Return-1 pointed out that DeviceEventEmitter.addListener("pushOpened", () => {} would not be called called when opening app from push. On iOS we could use PushNotificationIOS.getInitialNotification() but how should we handle it on Android? Or is there something built in Pushwoosh?