Android Library to get best available location . Getting location in background or foreground is just a 5 lines of code away :)
Alternatives To Androidbestlocationtracker
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Unifiednlp84542 months ago8April 24, 202291Java
Alternative network location provider for Android, with plugin interface to easily integrate third-party location providers.
Wifimatic Android62
5 years ago16Java
Wi-Fi Matic Android App
5 years ago10apache-2.0Java
UnifiedNlp Backend that uses Apple's service to resolve wifi locations. Location calculation is done onboard and wifi locations are cached to minimize data usage.
a year ago9April 18, 2022mitKotlin
Easy Location fetching for Android apps.
Tracking Location Provider Android31
5 years ago3Java
Tracking the android mobile and animating marker smoothly in Google Maps. Tracking has been done both in foreground and background. Tested in Android Oreo 8.1, Android 6.0 and Android 5.0
4 years agomitDart
An Android App, which lets you work on Location Data, built with :heart: using Flutter
5 months agoKotlin
Android Library to get best available location . Getting location in background or foreground is just a 5 lines of code away :)
3 years ago3mitKotlin
Android application which allows you to add notes to the current location
Google Maps Tracker23
8 years agootherJava
Android app to report/track your location using Google Maps API
5 years ago3Java
Location fetch library.
Alternatives To Androidbestlocationtracker
Select To Compare

Alternative Project Comparisons


Get best available locaiton from android locaiton providers

use latest version 2.0.10

Whats comming next ?

To make location data as stream and not callback. Will be incorporating flow{} to this lib.

Live Location Sharing ========================

Android Best Location Tracker is an Android library that helps you get user best location with a object named BaseLocationStrategy that would give a accurate location using accuracy alogirthm.


Add this to your build.gradle file

repositories {
    maven {
        url ""

dependencies {
         implementation 'com.github.balwinderSingh1989:androidBestLocationTracker:2.0.6'

Don't forget to add the following permissions to your AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
add below if you need locaton in background for android Q and above. Check out this blog
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />


To create a tracker you just need to add the below code in your Android Activity/Service

// You can pass an ui Context but it is not mandatory getApplicationContext() would also works
// Be aware if you target android 23, you'll need to handle the runtime-permissions !
// see
if (    ContextCompat.checkSelfPermission(ctx, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
    || ContextCompat.checkSelfPermission(ctx, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        // You need to ask the user to enable the permissions
} else {

  private void setupLocation()
         baseLocationStrategy = getLocationStatergy(this, this)

         baseLocationStrategy?.apply {

                  shouldFetchWhenInBackground(fetchAggresively = true, lifecycle)

                  NOTE :SET  fetchAggresively true if you need location in background faster than android default (which is few times in a hour).
                  when this is TRUE : for android API  < 31, location will be fetched by foreground service and for above lib will use workmanger

                  REMEMBER : You would need permission <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> to fecth location in
                  background for Adnroid 10 and above

                  lifecycle  = set this to activity as lib would use this lifecycle to bind the foreground service and would start the service once the activity is not visible
                  (i.e activity is in background)


                  startListeningForLocationChanges(object : LocationChangesListener {
                      override fun onBetterLocationAvailable(location: Location?) {
                          Log.d(TAG, "onBetterLocationAvailable  ${location.toString()}")

                      override fun onConnected() {
                          Log.d(TAG, "onConnected")

                      override fun onConnectionStatusChanged() {}
                      override fun onFailure(s: Error) {
                         //check error codes here


//also from android 10 and above , one cannot ask foreground and background location at the same time. Hence for background location one should have a proper use case
//and UI option to trigger background location. Once you have decided the use case, you can call below fun to let lib known that ACCESS_BACKGROUND_LOCATION is granted, so that
//lib can start providing you location when your app is in background.

     btnStartBackgroundFetch.setOnClickListener {
            if (ContextCompat.checkSelfPermission(
                ) == PackageManager.PERMISSION_GRANTED

            ) {
            } else {
                    ), REQUEST_CODE

And it's done, as soon as a location gets available, it will call the onLocationChanged() with latest and best available locaition. Also, to get lastKnown location any time (this should only we called if )


Manage the tracker

By default, after a baseLocationStrategy is created, it automatically starts listening to updates... and never stops. LocationTracker has two methods to start and stop listening for updates.

If you want to stop listening for updates, just call the baseLocationStrategy.stopListeningForLocationChanges() method. For example, if you need a one shot position, you can do that:

 baseLocationStrategy.startListeningForLocationChanges(new LocationChangesListener() {
            public void onLocationChanged(Location location) {
                //get best accurate location here and here you can stop
            public void onConnected() {
                //best location provider has been connected and you will surely get location changes now
            public void onConnectionStatusChanged() {
            public void onFailure(String s) {

You can also do it in the onPause() Activity method if you want.

protected void onPause() {
	if(baseLocationStrategy != null) {

REMEMBER! A LocationTracker never stops untill you tell it to do so.

You may want to start listening for updates after all. To do that, LocationTracker has a public method named startLocationUpdates(), call it when you want.

For example, in the onResume() Activity method:

protected void onResume() {
	if(baseLocationStrategy != null) {

Contact & Questions

If you have any questions, fell free to send me an email at [email protected] You can also fork this project, or open an issue :)

Popular Location Projects
Popular Android App Projects
Popular Libraries Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Android App