开发者

Where is a good place to grab GPS data?

I in my android application I want to track GPS information and use this i开发者_开发技巧nformation in all activity.

Is it a good way to use onLocationChanged, in the Application class?

I also want to have a timer that will measure the elapsed time, and use in all applications not only in one Activity

The information onLocationChanged and timer and want to use in all activities in my application

Functions are not problem, problem is that I want to use function information in all my android application!


maybe you want to create an Android Service to which your Android applications bind. Then you can handle the GPS location change and the timer stuff centrally in the service.

Any of your Activities can bind to the service and retrieve the info you need.


As codinguser said, the correct way to handle this is using an Android Service.

I would prefer using a Broadcast intent instead of binding. From my point of view, it's easier.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜