[英]get location without google play services -android
I know some phones do not preinstall google play sevice. 我知道有些手机没有预装谷歌播放服务。 I want to ask is there possible way to get location without Google Play Services , just use LocationManager.
我想问一下,如果没有Google Play服务可以获得位置,只需使用LocationManager。 Not LocationClient.
不是LocationClient。
you can use LocationManager 你可以使用LocationManager
LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(LOCATION_SERVICE);
Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
Just use the location manager like you said 就像你说的那样使用位置管理器
http://developer.android.com/guide/topics/location/strategies.html http://developer.android.com/guide/topics/location/strategies.html
USe a LocationManager and set the appropriate provider, GPS or NETWORK. 使用LocationManager并设置适当的提供商,GPS或NETWORK。 you can get periodic updates or a single update using the requestLocationUpdates() and the getLastKnownLocation() methods respectively.
您可以分别使用requestLocationUpdates()和getLastKnownLocation()方法获得定期更新或单个更新。 Lastly, get a Location object and retrieve the latitude, longitude by calling the required methods on the Location object.
最后,获取Location对象并通过调用Location对象上的必需方法来检索纬度,经度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.