Introduction: LocationManager Wrapper for Android
More: Author   ReportBugs   

AndroidStudio minSDK

Locationmanager is a small wrapper for Location Tracker.


  • Add jitpackto your repositories in Project build.gradle :

    allprojects {
      repositories {
          maven { url "" }
  • Add dependency :

    implementation 'com.github.grumpyshoe:android-module-locationmanager:1.1.0'


  • Get instance of LocationManager:

    val locationManager : LocationManager = LocationManagerImpl()

    In order to locate your device, the library will request the permissions android.permission.ACCESS_FINE_LOCATION and android.permission.ACCESS_COARSE_LOCATION. To handle to permission request result correctly delegate the response of onRequestPermissionsResult in your activity to the library like this:

    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
      locationManager.onRequestPermissionsResult(requestCode, permissions, grantResults)
              ?: super.onRequestPermissionsResult(requestCode, permissions, grantResults)

    Get last known Location

    Try to get last known connection with getLastKnownPosition.

          activity = this,
          onLastLocationFound = { location ->
              // handle location data
          onNoLocationFound = {
              // handle no location data

Track location

If you want continuous information about device movement start the location tracking.

Start location tracking

To start location tracking call startLocationTracker.

          activity = this ,
          onLocationChange = { location ->
              // handle location data
          config = LocationTrackerConfig())

Stop location tracking

To stop location tracking call stopLocationTracker. This should be done at LifeCycleEvent onDestroy at least to avoid any error during off screen information.



Package Version 15.0.1

Need Help or something missing?

Please submit an issue on GitHub.


This project is licensed under the terms of the MIT license. See the LICENSE file.

Build Environment

  Android Studio 3.1.4
  Build #AI-173.4907809, built on July 23, 2018
  JRE: 1.8.0_152-release-1024-b01 x86_64
  JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  Mac OS X 10.13.4
Support Me
About Me
Google+: Trinea trinea
GitHub: Trinea