staltz / react-native-android-local-notification

Other
10 stars 10 forks source link

Open app from notification (from dead state) #6

Closed ko100v closed 5 years ago

ko100v commented 5 years ago

Hello, i was wondering do you plan to support a getInitialNotification, when the app is dead and started by clicking on the notification, some way of retrieving that notification payload?

Thanks.

ko100v commented 5 years ago
Notification.addListener('press', function(e) {
  console.log(e.payload);
});

Is actually having the payload when the app is opened from notification, on more thing you need { AppState } from 'react-native' so you track when the app is opened from notification while in background, and create the listener again so you can get the payload of that notification too.