The simplest way to get the user's current location in Android

I need to get the mobile user's current position using the simplest method without using too much resources of the mobile phone. Please explain me the best way to accomplish this.

Comments

  • Please refer this resource.

  • Lean to get gps location in android using LocationManager and LocationListener.
    Add permissions to your manifest file:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    Then you need to get location using below code snippet:
    `locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

    locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER,
    2000,
    10, this);`

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories