Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
446 views
in Technique[技术] by (71.8m points)

android - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...