Service and standby

264 Views Asked by At

I have a background Service that control with sensor accelerometer when the phone is upside down and if it's true phone sound. If I run the service and put my phone upside down it's ok but if I push power button and able a lock screen the phone not sound. I don't understand if the service is stopped or is the sensorchangelistener. i have also used into onCreate the wakelock.acquire method but it work good with my phone (galaxy s) but not work with phone of my friend (motorolo defy).. Can you help me? :-(

1

There are 1 best solutions below

0
On

It's not possible to use sensors while the phone is in standby, or even with a partial wake lock. You need a full wake lock to keep receiving sensor updates. Supposedly some phones have a workaround, in that once the phone goes into standby you can request sensor updates again, but this only works for a few phones, and is hardly a reliable solution. So in short, the only way is to keep the phone awake.