get location without google play services -android

允我心安 提交于 2019-12-03 09:41:11

you can use 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

USe a LocationManager and set the appropriate provider, GPS or NETWORK. you can get periodic updates or a single update using the requestLocationUpdates() and the getLastKnownLocation() methods respectively. Lastly, get a Location object and retrieve the latitude, longitude by calling the required methods on the Location object.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!