I am unable to understand
Can anyone explain clearly with examples.
I went through this link but couldn't understand it clearly.
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_NOT_STICKY- tells the system not to bother to restart the service, even when it has sufficient memory. START_REDELIVER_INTENT- tells the system to restart the service after the crash and also redeliver the intents that were present at the time of crash.
START_STICKY tells the OS to recreate the service after it has enough memory and call onStartCommand() again with a null intent. START_NOT_STICKY tells the OS to not bother recreating the service again.
According to how services stick to your application Non-sticky Redeliver-Intent services — it is same as non sticky content but the only difference is it will re-deliver the same intent until it completes.
These are related to services. We all know that services keeps on running in the background and they also consume some memory to execute.
So, as more of the application runs on android device, the device memory keeps on getting low and when the time arises, when the device memory gets critically low, the android system starts terminating processes, so as to release the memory occupied by the processes.
But you might be doing some important task with the services, that could also get terminated as the service stops. so these concepts are to tell the android system what action you want to perform when the device memory gets stable and when it is ready to relaunch the services.
The simplest explanation of these could be,
START_STICKY-
tells the system to create a fresh copy of the service, when sufficient memory is available, after it recovers from low memory. Here you will lose the results that might have computed before.
START_NOT_STICKY-
tells the system not to bother to restart the service, even when it has sufficient memory.
START_REDELIVER_INTENT-
tells the system to restart the service after the crash and also redeliver the intents that were present at the time of crash.
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