I have a notification that started in a service. When user click on this notification, an activity starts.
My problem is: if user press back button in this activity, navigates to home screen instead of previous activity.
I want push new activity to existing task.
Intent openIntent = new Intent(this, MediaPlayerActivity.class);
openIntent.setAction(ACTION.OPEN_ACTION);
PendingIntent openPendingIntent = PendingIntent.getActivity(this, 0, openIntent, 0);
Notification notification = new NotificationCompat.Builder(this, "")
.setContentTitle(bundle.getString("Title"))
.setContentText(bundle.getString("Description"))
.setContentIntent(openPendingIntent)
.setShowWhen(false)
.setOngoing(true)
.build();
startForeground(NOTIFICATION.PLAYER, notification);
Sample 1:
Activity A -> Activity B -> (Notification click)
i want this:
Activity A -> Activity B -> Activity Z
OR
Sample 2:
Activity A -> Activity B -> Activity C -> (Notification click)
I want this:
Activity A -> Activity B -> Activity C -> Activity Z
OR
Sample 3:
Activity A -> Activity B -> (Home button) -> (Notification click)
I want this:
Activity A -> Activity B -> Activity Z
but I have this at all samples:
Activity Z ->(Back press)-> Home screen