在Android服务中两次接收onTaskRemoved()回调

时间:2019-06-25 07:14:12

标签: android kotlin service

当应用程序在前台/后台运行时,我已经创建了START_NOT_STICKY服务。当我第一次从最近的列表中取消该应用程序时,仅从onTaskRemoved(rootIntent:Intent?)回调中获取一次回调,因此我调用stopSelf()。

此后,当我重新启动该应用程序时,该服务将重新启动,但是再次从最新的应用程序中删除/杀死该应用程序时,我会两次收到onTaskRemoved(rootIntent:Intent?)。有人可以帮助我了解这是怎么可能的吗?

2019-06-25 12:38:49.840 E/BluetoothService: onTaskRemoved
2019-06-25 12:38:49.845 E/BluetoothService: onTaskRemoved
2019-06-25 12:38:49.852 I/BluetoothService: Service onDestroy

0 个答案:

没有答案