I have an activity A
that is either started from another activity B
or via PendingIntent
from a Notification
, which is created in a service. The notification is shown regardless of the activity being started from another activity or not. A
has a button which makes the activity close itself.
I now want to implement the following behavior:
- If the activity
A
is run fromB
and the user touches the button, the app should return toB
. - If the activity
A
is run fromB
and the user touches the notification, the running activityA
should be shown. If the user touches the button, the app should return toB
. - If the activity
A
is not run fromB
and the user touches the notification, A should be started. If the user touches the button, the App should be completely closed (except forServices
/BackgroundReceivers
running in the background).
What flags do I need to set / how do I start the Activity
? Currently, activity B
starts the service which creates A
and the notification. The reason for this is that A
might also need to be created from a BroadcastReceiver
, which starts the service. Is this the right way?