my app have a availability states to show if user is online or not, now when user closes the app it would gives value of 0 and 1 if he is online.
now when user closes the app with recent apps button there is no activity lifecycle for it so i can't control the action to send info that user is offline.
so any solution to be able to control what happens when user closes app with recent apps?
Update user online status in onPause()
.
onPause()
use-case as per Docs.
This callback is mostly used for saving any persistent state the activity is editing, to present a "edit in place" model to the user and making sure nothing is lost if there are not enough resources to start the new activity without first killing this one. This is also a good place to stop things that consume a noticeable amount of CPU in order to make the switch to the next activity as fast as possible.