I am developing an Android app that also includes a Service. The 'Swipe to Exit' functionality of the ICS recent apps list closes the app as expected, but the Service just exits along with it and does not receive an onTaskRemoved() callback to tell it to clean up (or onDestroy() for that matter):
http://developer.android.com/reference/android/app/Service.html#onTaskRemoved(android.content.Intent)
This leaves the notification icon in the status bar and I need to make sure this is removed when the app exits.
I've tried setting android:stopWithTask to false (and true) in Manifest.xml and it seems to make no difference.
<service
android:name="com.test.TestService"
android:stopWithTask="false"
/>
Any ideas why the onTaskRemoved() callback is not being received?
When the Service
started with startService()
and onTaskRemoved()
was called when the app removed from recent-apps-list by swipe.
But if the Service
started with bindService()
, then onTaskRemoved()
never gets called.
Please check reference here to see if it resolves your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With