Reputation: 9319
I'm creating a silverlight app to track movement (using accelerometer) over night. The problem is that when the screen gets locked (as usual after a while) it stops running until I unlock again. Is there a way to keep it alive when the screen is locked? Maybe someone knows how it was solved in apps like WhatsApp or Line, which must be running to receive text messages.
I did some research about background workers, but it seems they can only be executed every ~30 minutes for a maximum of ~25 seconds, which is useless in my case.
Upvotes: 0
Views: 292
Reputation: 8426
An application can continue to run when the phone is locked by setting the PhoneApplicationService.ApplicationIdleDetectionMode property
This blog describes it in detail Running a Windows Phone Application under the lock screen
There is an issue with this though. If a user intentionally locks the phone the app will be considered idle. If screen goes off by itself it won't.
(Also leaving an accelerometer on overnight is a bad idea in general for battery concerns.)
Upvotes: 2