react-native-gcm-android icon indicating copy to clipboard operation
react-native-gcm-android copied to clipboard

app closed - find which notification launched app - popInitialNotification equivalent

Open jawadrehman opened this issue 10 years ago • 6 comments

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.

jawadrehman avatar Dec 23 '15 16:12 jawadrehman

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 avatar Dec 23 '15 16:12 oney

@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.

jawadrehman avatar Dec 24 '15 00:12 jawadrehman

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.

oney avatar Dec 24 '15 03:12 oney

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.

jawadrehman avatar Dec 24 '15 10:12 jawadrehman

Can you share codes or create a PR? It will be very useful to me.

oney avatar Dec 25 '15 02:12 oney

pull request here. https://github.com/oney/react-native-gcm-android/pull/19

jawadrehman avatar Dec 25 '15 19:12 jawadrehman