27

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. Not LocationClient.

Onur A.
  • 3,007
  • 3
  • 22
  • 37
user2506173
  • 3,959
  • 3
  • 16
  • 9

2 Answers2

23

you can use LocationManager

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

Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
Onur A.
  • 3,007
  • 3
  • 22
  • 37
  • @user2506173 this has nothing to do with maps they are completely independant – tyczj Jul 18 '13 at 15:11
  • you can get latitude and longtitude and with that values show that place in the map – Onur A. Jul 18 '13 at 21:33
  • V1 maps are still supported, if you already got a key for your application, but no new Google Maps V1 keys are generated anymore, which will force new application to use V2. – Alexander Pacha Jul 19 '13 at 11:10
2

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.