简体   繁体   English

如何在Android的后台服务中获取当前位置

[英]How to get current location in background service in android

I am using custom GoogleLocationClient for getting the location in the entire project. 我正在使用自定义GoogleLocationClient获取整个项目中的位置。 there is a constructor with two parameters, one is activity and another is Listener, now I want to get the location in background service with using the same class, how to achieve this can any body help me out, 有一个带有两个参数的构造函数,一个是activity,另一个是Listener,现在我想使用同一类在后台服务中获取位置,如何实现这一点,任何机构都可以帮助我,

here is a constructor with two parameters, one is activity and another is Listener, now I want to get the location in background service with using the same class 这是一个带有两个参数的构造函数,一个是activity,另一个是Listener,现在我想使用同一类在后台服务中获取位置

It actually needs a context not activity exactly. 实际上,它需要一个上下文,而不是确切的活动。

Anyways, you can follow the google samples of location 无论如何,您可以按照Google位置示例

https://github.com/googlesamples/android-play-location https://github.com/googlesamples/android-play-location

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM