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

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 USAPosts: 132Member

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 USAPosts: 342Member

    Please refer this resource.

  • rajatghai22rajatghai22 delhiPosts: 2Member

    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.