1

I'm having trouble to understand how the map.setmylocationenabled(true) actualy gets my location every time I move. And my question is: Is there a way to extract longitude and latitude from map.setmylocationenabled(true)?

The code that shows my location on the map and updates it every time I move.

map.setmylocationenabled(true)
Fig
  • 275
  • 1
  • 7
  • 19
  • link will help you. https://stackoverflow.com/questions/33720614/what-is-firebase-and-how-to-use-it-in-android – Vivek Patel Feb 27 '18 at 13:32
  • I'm not planning to use firebase, and I don't see how that post can help my situation – Fig Feb 27 '18 at 14:00

1 Answers1

0

Just follow the guide about it here. You should use requestLocationUpdates() to ask for updates. And in onLocationChanged() call getLastKnownLocation() to obtain a Location object on which you can call getLatitude() and getLongitude(). (getLatitude doc)

vincrichaud
  • 2,218
  • 17
  • 34