一个服务已经执行了onTaskRemoved()方法.
当服务以startService()onTaskRemoved()方式开始时,该应用程序通过滑动从最近的apps-list中删除.
但是如果服务以bindService()开头,那么onTaskRemoved()从未调用过.
当使用bindService()启动应用程序后,通过滑动从最近的apps-list中删除应用程序时,如何使服务调用onTaskRemoved()?
以下方法调用,如果开始:
1. bindService():
Activity﹕ onCreate()
CustomService﹕ onCreate()
CustomService﹕ onStart()
CustomService﹕ onStartCommand()
CustomService﹕ onBind()
// Here we swipe to remove app from recent-apps-list
CustomService﹕ onTrimMemory()
2. startService():
ActivityA﹕ onCreate()
CustomService﹕ onCreate()
CustomService﹕ onStart()
CustomService﹕ onStartCommand()
CustomService﹕ onBind()
// Swipe to remove app from recent-apps-list
CustomService﹕ onTrimMemory()
CustomService﹕ onTaskRemoved() // <=====
CustomService﹕ onUnbind()