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
Ais run fromBand the user touches the button, the app should return toB. - If the activity
Ais run fromBand the user touches the notification, the running activityAshould be shown. If the user touches the button, the app should return toB. - If the activity
Ais not run fromBand the user touches the notification, A should be started. If the user touches the button, the App should be completely closed (except forServices/BackgroundReceiversrunning 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?