0

Clicking on single notifications from OneSignal opens my app without issues, but if I have a grouped notification, it attempts to open the app and then closes it without much error. The only thing I can really see of relevance in my output logs is there are multiple "Activity_launch_request", one for each notification in the group, as soon as I click the grouped notification. (My device is a Xiaomi Mi Max, that tag may just be specific to this device)

Relevant notification click handling code:

        @Override
        public void notificationOpened(OSNotificationOpenResult result) {
            bug.out("notificationOpened");
            OSNotificationAction.ActionType actionType = result.action.type;
            JSONObject data = result.notification.payload.additionalData;

            Intent intent = new Intent(AndroidLauncher.this, AndroidLauncher.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
            PendingIntent contentIntent = PendingIntent.getActivity(AndroidLauncher.this, 0, intent, 0);
            try {
                contentIntent.send();
            } catch (PendingIntent.CanceledException e) {
                e.printStackTrace();
            }

        }

Note that even though "Activity_launch_request" gets fired "group_count" times, "notificationOpened" only gets printed once, so it's safe to say my launch intent only gets fired once.

My activity launchMode is "singleTop".

Can someone please help me fix this issue?

hamham
  • 561
  • 4
  • 13

1 Answers1

0

This turned out to be a payload and AndroidManifest issue, our website url was in the payload and my AndroidManifest had an intent-filter to launch the app from our url.

hamham
  • 561
  • 4
  • 13