Which function is called when application is removed from task manager
问题 I need to make status of user offline. When I press home button onStop() is called, that's fine. When I press back button onDestroy() is invoked. But when I close the app from recent apps by swiping it, onStop() or onDestroy() isn't called. I need to know when the app is closed from recent apps to do something (e.g make user offline). 回答1: Make a service : public class MyService extends Service { private DefaultBinder mBinder; private AlarmManager alarmManager ; private PendingIntent