在没有谷歌play服务的情况下获取位置-android

在没有谷歌play服务的情况下获取位置-android,android,google-maps,geolocation,Android,Google Maps,Geolocation,我知道有些手机没有预装谷歌play服务。我想问的是,是否有可能在没有谷歌Play服务的情况下获取位置,只需使用LocationManager即可。不是LocationClient。您可以使用LocationManager LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE); Location location = locati

我知道有些手机没有预装谷歌play服务。我想问的是,是否有可能在没有谷歌Play服务的情况下获取位置,只需使用LocationManager即可。不是LocationClient。

您可以使用LocationManager

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

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

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

@user2506173这与地图无关。它们完全独立。您可以获取纬度和经度,这些值显示mapV1地图中的位置仍然受支持,如果您已经获得了应用程序的密钥,但不再生成新的Google Maps V1密钥,这将强制新应用程序使用V2。