LocationManager not found on GetSystemService(LocationService)

Hello, I'm with this App that access the GPS Location, but when I call
LocationManager locationManager = (LocationManager)GetSystemService(LocationService);

I'm using on my MainActivity that inherits Activity and implements ILocationListener

It's null, why? Could somebody help me? Running on Android Emulator it works, but on smartphone doesn't. GPS is ON on the phone.

Thanks

Answers

  • abuAzarabuAzar Member

    Hello,

    you can just implement the ILocationListener in your Activity and you will have this member along with other ones.

    public void OnLocationChanged(Location location)
    {
    lat = location.Latitude;
    lng = location.Longitude;
    }

    this will definitely update your location.

    Best of luck

Sign In or Register to comment.