I have a service,
and when tapped a button, My Activity, fragment opens.
This is an Editor screen activity.
I have another activity on top of it, A chooser Activity.
When the user presses the Home
button from the Editor Activity,
the activity lifecycle goes to the onStop.
I am updating the parent service in the onDestroy
of the Editor Activity.
When the user presses the back button, it calls onDestroy
and updates the parent service layout.
However, when the Home
button is pressed, the activity calls the onStop,
and the service is not updated.
I need to finish the activity when the Home
button is pressed.
I cannot use the onUserLeaveHint()
as I have the chooser Activity
on top of the Editor Activity.
I cannot destroy the Activity in onStop
as well, because of the chooser Activity.
I have also tried using the onKeyDown,
but didn't get detected on pressing the Home
button.
Also tried clearTaskOnLaunch
and launchMode = singleInstance
as well.