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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.