4

Currently I have this:

Intent resultIntent = new Intent(context, DigestPager.class);

and this is opening DigestPager activity (which is not launcher activity) when clicking on a single notification.

But when there are multiple notifications and they are grouped into one and collapsed, clicking on it is opening launcher activity.

Is there some simple way to open a different activity?

Intent resultIntent = new Intent(context, DigestPager.class);
resultIntent.putExtra("digestId", digest.getDigestId());

PendingIntent pendingIntent = PendingIntent.getActivity(this, digest.getDigestId(), resultIntent,
           PendingIntent.FLAG_UPDATE_CURRENT);

mBuilder.setContentIntent(pendingIntent);

NotificationManager mNotifyMgr = (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);

mNotifyMgr.notify(digest.getDigestId(), mBuilder.build());

1 Answers1

0

Create a handler activity that opens everytime you click on a notification and based on the flags set to the notification, you can navigate to the required activity/fragment.

Hope this helps.

Geet Choubey
  • 1,069
  • 7
  • 23
  • Thing is that I can't handle the intent when clicking on notification group. It's opening launcher activity and not passing any extras. – unexpected_err Mar 07 '17 at 10:55