开发者

android: LocationListener running permanently

开发者 https://www.devze.com 2023-02-01 18:52 出处:网络
I have an app which will start sending location data to a remote server, when I press a button. I am using LocationListener since I开发者_如何学C want to send the location points if a certain distance

I have an app which will start sending location data to a remote server, when I press a button. I am using LocationListener since I开发者_如何学C want to send the location points if a certain distance or time threshold is reached.

I want the LocationListener to send data to the server as long as the phone is on and the button is not pressed back to shut it down.

How can I do that?

How can I have the LocationListener to run continuously as long as the phone is on - even if I am not running the app which activated the location listener?


You have to run this in a service. Are you sure you want to do this though? This will drain the battery fairly quickly.

0

精彩评论

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