开发者

Old values from battery change receiver while standby

I wrote a service with a broadcastreceiver listening on BATTERY_CHANGE. The thing is when the screen is on it works perfectly, but when the phone goes into standby, the service is receiving just the old battery levels.

So for example the screen turns off at 50% battery state, then I'm receiving 50% all the time and when I wake up the phone some time later I get the correct battery state i.e. 40%

Does someo开发者_Python百科ne else run into that issue or is there an fix for that ???

PS: I tested it on LG2X and HTC Magic.


Ok it is not possible to receive updates from the battery meter while the screen is off. I do solved it with inexact repeated updates and an intentservice


How are you registering the Receiver? Via Manifest or registering it by code? This intent has to be registered to be received on code, so this can also be your problem if you are declaring it on the Manifest. (see Documentation)

Also, you can try and compare your code with this one as it looks like it's working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜