I have created a START_NOT_STICKY Service while the app is running in foreground/background. When I kill the application from the recent list for the first time I am getting the callback only once and from onTaskRemoved(rootIntent: Intent?) callback, I am calling stopSelf().
After that when I am relaunching the app the Service is restarted but again when remove/kill the application from the recent apps I am receiving the onTaskRemoved(rootIntent: Intent?) twice. Could anybody help me understand how this is possible?
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