app closed - find which notification launched app - popInitialNotification equivalent
I think this module is 90% complete functionality wise. its just an equivalent of popInitialNotification that seems to be missing.
What I have figured out is that we will need to probably put an extra to the intent in onCreateNotification function of GcmModule.java , and probably create a method to give the value of that.
Yes, identifying which notification launched app isn't supported yet.
Besides putting an extra to the intent in onCreateNotification, we should listen intent when launch the app.
In MainActivity.java
protected void onCreate(Bundle savedInstanceState) {
getIntent(); // check if launch from notification, and send to JS
...
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// send intent to GcmAndroid module
}
There are some works to do, I think I may not have time to do it this week.
@oney i might have sorted it out - I would like to submit this as a pull request. can you give me details on how to do this.
https://github.com/zo0r/react-native-push-notification/blob/b826276e291c0ab011eec80b210d39b63a1c2437/RNPushNotificationAndroid/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java#L50 This module already handles the feature. We can use some codes and the idea to do it.
I have done something similar. But also changed a few lines of your code, since with your code only one notification would show up if the app is not open.
Can you share codes or create a PR? It will be very useful to me.
pull request here. https://github.com/oney/react-native-gcm-android/pull/19