![](/img/trans.png)
[英]get user location not working on android devices without google play services
[英]get location without google play services -android
我知道有些手机没有预装谷歌播放服务。 我想问一下,如果没有Google Play服务可以获得位置,只需使用LocationManager。 不是LocationClient。
你可以使用LocationManager
LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE);
Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
使用LocationManager并设置适当的提供商,GPS或NETWORK。 您可以分别使用requestLocationUpdates()和getLastKnownLocation()方法获得定期更新或单个更新。 最后,获取Location对象并通过调用Location对象上的必需方法来检索纬度,经度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.