如何在android中获取当前位置的经纬度在我的应用程序中,我在应用程序打开时获取当前位置的纬度和经度,但在应用程序关闭时不会。我正在使用Service类来获取我的应用程序中的当前位置纬度和经度。即使应用程序关闭,请告诉我如何获取当前位置的纬度和经度
3 回答
![?](http://img1.sycdn.imooc.com/54584f850001c0bc02200220-100-100.jpg)
12345678_0001
TA贡献1802条经验 获得超5个赞
试试这个,希望每次位置变化时它都会帮助您获取当前位置。
public class MyClass implements LocationListener { double currentLatitude, currentLongitude; public void onLocationChanged(Location location) { currentLatitude = location.getLatitude(); currentLongitude = location.getLongitude(); }}
- 3 回答
- 0 关注
- 790 浏览
添加回答
举报
0/150
提交
取消