[android-developers] Re: Swipe app out of recent tasks permanently kills app (like force-stop) even though it's running background services!
You have to use START_STICKY which is a sticky service, also add flag FLAG_FROM_BACKGROUND while starting your service. when you use START_STICKY make sure you do not pass any data via intent, since your app/activity is killed, but you can re-start the service.
Ex : you need to read the values from Sensors and do operations. all the values are generated within the service only.
you have to call stopService(); manually to kill the service, else you will use huge memory.
-- Ex : you need to read the values from Sensors and do operations. all the values are generated within the service only.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// We want this service to continue running until it is explicitly stopped, so return sticky.
return START_STICKY;
}
you have to call stopService(); manually to kill the service, else you will use huge memory.
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home