开发者

My android app stops recording GPS data when screen goes to home after being idle

I have this activity that is recording GPS positions along a route. I am not sure what the processes or methods I need to keep this alive even after my screen shuts off and the security trace thingy comes up. It seems the stop recording happens, right now I have two buttons that handle a boolean that starts recording or not. I am not sure what I have to do or what event I have to trap to make sure my state of the program remains constant even if another call comes in, or something else happens... (Do I have to make it a service?!)

Really I only care about the gps recorder still rec开发者_运维知识库ording after the screen goes dark cause phones been idle. Before I put that security patttern draw thingy it would work, but now that its on something else is going on where my code state is getting kind of hosed. Whats this wake lock I hear about?


Simple answer: yes, u need a service

Complicated one: Activity dies as soon as its out of focus, so if you want to continue recording data, you need to make it a service.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜