Search code examples
androidlocationmylocationoverlay

android, Is this a right way of using MyLocationOverlay for getting user location to send it to server...?


I am new to android. I have learned about MyLocationOverlay. It can get user location and draw a blue point on that location. I want to get user location and send it to server. Is it possible by using MyLocationOverlay to get user location. If it is, then is this a right way of getting user location using MyLocationOverlay...???


Solution

  • Is it possible by using MyLocationOverlay to get user location.

    Yes, you can call getMyLocation(). However, as with getLastKnownLocation() on LocationManager, this may be null.

    If it is, then is this a right way of getting user location using MyLocationOverlay...???

    Personally, I would rather use LocationManager directly, so I have more control over how that location is determined.