Howdy, Stranger!

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

Categories

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

NickFNickF USAMember Posts: 132

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.

Tagged:

Comments

  • DavidMDavidM USAMember Posts: 342

    Please refer this resource.

  • rajatghai22rajatghai22 delhiMember Posts: 2

    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.