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

时间:2013-07-18 14:47:08

标签: android google-maps geolocation

我知道有些手机没有预装谷歌播放服务。我想问一下,如果没有Google Play服务可以获得位置,只需使用LocationManager。不是LocationClient。

3 个答案:

答案 0 :(得分:13)

您可以使用LocationManager

LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE);

Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

答案 1 :(得分:2)

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

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

答案 2 :(得分:1)

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