OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
604 stars 368 forks source link

Android 7+ auto grouping of 4 or more notifications does not track open #666

Closed jkasten2 closed 5 years ago

jkasten2 commented 5 years ago

Issue

On Android Nougat (7.0)+ when 4 or more notifications are received Android will auto group them. However the Intent it sets up just launches the app's main Activity so this causes OneSignal to not be able to track an open.

Workaround

Set the same Group Key for all your notifications. This will make the OneSignal Android SDK setup it's own group notification with it's own Intent.

Implementation

Implementation Options

Need to re-evaluate what should happen when tapping on the summary notification to fix this issue. Three possible 3 candidates are;

  1. Count the most recent notification in the group as opened. Leaving all others in the group.
  2. Count the most recent notification in the group as opened. Dismissing all others in the group.
  3. Count all notifications in the group as opened.
    • When a group key is set from OneSignal this is what is done today.
    • Considering moving off of this as conversions could be misleading since the user could have opened a very large group of notifications (up to 49).

Implementation Details

Solutions

Solution 1

Always set a group internally on Android 7+ so OneSignal will setup a group Intent. This will have the side effect of notifications grouping at 2 instead of 4 however.

Solution 2

On Android 7+ check all notifications in the shade, if there are 3 currently in the shade create a group. It doesn't matter if the notification was created from OneSignal or not since we need to prevent Android from executing it's auto grouping at 4 notifications.

rgomezp commented 5 years ago

Issue is being addressed and is being tracked internally.

ejain commented 3 years ago

How was this resolved? I don't see groupedNotifications in the event, which according to https://github.com/OneSignal/react-native-onesignal/issues/1046 is an issue with the native SDK...

Ideally, I'd want to have the most recent notification opened, with the rest left in place; is this still an option?

ejain commented 3 years ago

Just upgraded react-native-opensignal to 4.3.0, and while I do now see a groupedNotifications property in the notification opened event, this property is null when a grouped notification was opened...