繁体   English   中英

获取位置没有谷歌播放服务-android

[英]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);

就像你说的那样使用位置管理器

http://developer.android.com/guide/topics/location/strategies.html

使用LocationManager并设置适当的提供商,GPS或NETWORK。 您可以分别使用requestLocationUpdates()和getLastKnownLocation()方法获得定期更新或单个更新。 最后,获取Location对象并通过调用Location对象上的必需方法来检索纬度,经度。

暂无
暂无

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

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