开发者

Problem with sensors in a service

i've a foreground service that read Accelerometer and Orientation sensors, and send a sms when the phone it's moved.

It works fine when the display is turned on, but when not it not works or it send the sms after lot of ti开发者_开发百科mes.

There is a broadcastreceiver in the service for reading incoming sms that works fine, if i send the command "status" its reply correctly.

What's the problem?

Thanks!


You need to acquire a wake lock to continue receiving sensor events.

http://developer.android.com/reference/android/os/PowerManager.html

I suggest a partial wake lock.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜