开发者

Android: Keep GPS active

开发者 https://www.devze.com 2022-12-17 01:31 出处:网络
i\'m having a main activity that runs a gps listener. If i\'m starting a new activity the listener is destroyed.

i'm having a main activity that runs a gps listener. If i'm starting a new activity the listener is destroyed. I need the gps to be still activated, also after starting the 2nd activity. Do i have to implement an own listener there, or is there another开发者_StackOverflow solution?


I recommend creating a Service that extends LocationListener. I would start your Service from your Activity using startService.

Here is an example: http://androidgps.blogspot.com/2008/09/simple-android-tracklogging-service.html

0

精彩评论

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