Search code examples
javaandroidlocation

Android - Get Location Only One Time


i need to get the current user location on an android app, so i've read some tutorials and samples on the web, but i see that in all the examples, the location is retrived from a "onLocationChange" that mean that every time the location change, the code in the "onLocationChange" is executed.

i need only to get the user location at the moment the app is started.

Thanks for your help!


Solution

  • You can do this with LocationManager.getLastKnownLocation