Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between START_STICKY and START_REDELIVER_INTENT?

I am creating a service for my android app, providing data to the service via Intents. The problem is that when the service is destroyed by the system than the intent data provided to it can't be restored, as a result of which my app crashes.

I have heard START_REDELIVER_INTENT will restart my service as soon as there is sufficient memory available restoring the intent data provided to service whereas the START_STICKY will not restore the intent data.

am i right ? or is there something I don't know ?

Also my service is taking forever to restart after it is destroyed by the system.

enter image description here

like image 985
Rakesh Avatar asked Feb 27 '14 03:02

Rakesh


1 Answers

START_STICKY- It will tell the system to create a newest copy of the service, when available memory is sufficient to do, after it retains state and recovers from the low memory. In this process we will loose the results that might have calculated before.

START_REDELIVER_INTENT- It will tell the system to restart and regain the service after the crash and also redeliver the intents that were present at the time of crash happened.

beside this we can have also a little note about START_NOT_STICKY

START_NOT_STICKY- It will tell the system not to worry and bother about to restart the service, even when it is having sufficient available memory.

please visit for more

http://developer.android.com/reference/android/app/Service.html

like image 106
Jitesh Upadhyay Avatar answered Oct 12 '22 02:10

Jitesh Upadhyay