When the user drags down all notifications and then tap on my app notification, then the app opens.
However, if a fresh notification appears on top on device screen and the user taps it, it does not open.
What could be the issue?
Intent intent = Activity1.createIntent(app.getApplicationContext());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
Activity2.createIntent(app.getApplicationContext(), new ArrayList<>(participants));
PendingIntent pendingIntent =
PendingIntent.getActivity(app.getApplicationContext(), 1000, intent, PendingIntent.FLAG_CANCEL_CURRENT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Bitmap bm = BitmapFactory.decodeResource(app.getResources(), R.mipmap.appiconmain);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(app.getApplicationContext())
.setSmallIcon(R.drawable.new_item_arrival, Notification.PRIORITY_HIGH)
.setLargeIcon(bm)
.setContentTitle(displayNotificationData.getTitle())
.setContentText(displayNotificationData.getSubTitle())
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setPriority(Notification.PRIORITY_HIGH)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) app.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());