Link to home
Create AccountLog in
Avatar of Chris Drew
Chris DrewFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Android Application with Service running in the background

I have an Android application (written using Mono for Android) which needs to upload changes made to data back to a back-end server.  To do this I have created a Background Uploader Service which is started by the application but then should run in the background separate from the application.  It checks a folder for update files and then sends these back to the server.

This all works fine even if the application itself has been shut down as I would expect but stops if the phone goes onto standby after 3 minutes of no user activity.  

Is there any way that I can keep the service active even if the phone has gone to sleep as I need to make sure that the uploads are completed and the user may not come back to the phone for an hour or so?

Most of the updates will complete very quickly as they are only a few K however I also upload photographs in the background.  These can take quite a few minutes and the transfer is killed off if the phone goes to sleep during the upload.
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Chris Drew

ASKER

Thanks - excellent idea which I will try - set a WaitLock while actually performing my uploads and release when there is nothing left to do.