Forum Xamarin.Android

Struggling Running Background Service Forever

ChintanChintan USMember

Hi Friends,

I have been trying to make this possible for 4 days now, have tried number of options but none of them worked. Let me know if you have a key to make it possible.

We are developing an Android App where we need to make a server request every certain time interval (it could be 30-60 minutes in production). We are using Started Service for this purpose. OnStartCommand() of the service returns back StartCommandResult.RedeliverIntent as we expect OS to restart service in case if it has to terminate it under low memory conditions.

Things work fine except the case where OS terminates the service under low memory condition. OS ALSO restarts the service but after random time gap (5 to 60 minutes). During that time it shows "0 process and 0 service Restarting..." under running services list in Settings --> Applicaiton Manager. Sometime I noticed that OS also terminates WhatsApp and I could see same status as above but somehow it manages to restart within some seconds. Any idea how it can be achieved?

Have tested with Android 2.2 and 4.0 and found similar behavior.

Thanks in advance.


Sign In or Register to comment.