Stackoveflow!
I have an application with sticky
background service and visible part, consisted of several activities.
I need to track start and stop of visible part (all activities). For example:
- When user starts MainActivity, Service receives LocalBroadcast that tells it to start something.
- When user rotates screen, Service must not receive anything.
- When user goes to SecondActivity, Service again must not receive anything.
- When user closes ALL ACTIVITIES, Service gets LocalBroadcast telling it to stop something.
If I use Activity
. onCreate
and onDestroy
, or onStart
and onStop
, I get events related to lifecycle of single activity. Also I get events related to screen rotation.
I also cannot use Application
. onCreate
or onTerminate
, as they will not trigger because of service running in the background.
I need to track real start and stop of entire application except service.