All Projects → quentin7b → Android Location Tracker

quentin7b / Android Location Tracker

Licence: mit
Android helper that tracks user location

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Android Location Tracker

Leku
🌍 Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
Stars: ✭ 612 (+111.76%)
Mutual labels:  library, geolocation
React Native Geolocation
Geolocation APIs for React Native
Stars: ✭ 640 (+121.45%)
Mutual labels:  library, geolocation
Libosmscout
Libosmscout is a C++ library for offline map rendering, routing and location lookup based on OpenStreetMap data
Stars: ✭ 159 (-44.98%)
Mutual labels:  library, geolocation
Slidecontroller
Swipe between pages with an interactive title navigation control. Configure horizontal or vertical chains for unlimited pages amount.
Stars: ✭ 279 (-3.46%)
Mutual labels:  library
Swiftuix
Extensions and additions to the standard SwiftUI library.
Stars: ✭ 4,087 (+1314.19%)
Mutual labels:  library
Pannellum
Pannellum is a lightweight, free, and open source panorama viewer for the web. Built using HTML5, CSS3, JavaScript, and WebGL, it is plug-in free. It can be deployed easily as a single file, just 21kB gzipped, and then embedded into pages as an <iframe>. A configuration utility is included to generate the required code for embedding. An API is included for more advanced integrations.
Stars: ✭ 3,286 (+1037.02%)
Mutual labels:  library
Beagle
A smart, reliable, and highly customizable debug menu library for Android apps that supports screen recording, network activity logging, and many other useful features.
Stars: ✭ 287 (-0.69%)
Mutual labels:  library
Immortaldb
🔩 A relentless key-value store for the browser.
Stars: ✭ 2,962 (+924.91%)
Mutual labels:  library
Framework7
Full featured HTML framework for building iOS & Android apps
Stars: ✭ 16,560 (+5630.1%)
Mutual labels:  library
Md parola
Library for modular scrolling LED matrix text displays
Stars: ✭ 282 (-2.42%)
Mutual labels:  library
Vue Advanced Cropper
The advanced vue cropper library that gives you opportunity to create your own croppers suited for any website design
Stars: ✭ 281 (-2.77%)
Mutual labels:  library
Swup
🎉 Complete, flexible, extensible and easy to use page transition library for your static web.
Stars: ✭ 3,190 (+1003.81%)
Mutual labels:  library
Rex
Your RegEx companion.
Stars: ✭ 283 (-2.08%)
Mutual labels:  library
Cyberscan
CyberScan: Network's Forensics ToolKit
Stars: ✭ 280 (-3.11%)
Mutual labels:  geolocation
Mojs
The motion graphics toolbelt for the web
Stars: ✭ 17,189 (+5847.75%)
Mutual labels:  library
Tiny Process Library
A small platform independent library making it simple to create and stop new processes in C++, as well as writing to stdin and reading from stdout and stderr of a new process
Stars: ✭ 276 (-4.5%)
Mutual labels:  library
React Modern Library Boilerplate
Boilerplate for publishing modern React modules with Rollup
Stars: ✭ 285 (-1.38%)
Mutual labels:  library
Dry Configurable
A simple mixin to make Ruby classes configurable
Stars: ✭ 280 (-3.11%)
Mutual labels:  library
Simple Php Router
Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.
Stars: ✭ 279 (-3.46%)
Mutual labels:  library
Cute headers
Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
Stars: ✭ 3,274 (+1032.87%)
Mutual labels:  library

android-location-tracker

Android Simple Location Tracker is an Android library that helps you get user location with a object named LocationTracker

Android Arsenal

Installation

Add this to your build.gradle file

repositories {
    maven {
        url "https://jitpack.io"
    }
}

dependencies {
        compile 'com.github.quentin7b:android-location-tracker:4.0'
}

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

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Be aware of Android Marshmallow's new permission system

<permission-group
   android:name="android.permission-group.LOCATION"
   android:label="A label for your permission"
   android:description="A description for the permission" />

Use

As its name says, it's a simple library. To create a tracker you just need to add the below code in your Android Activity / Service / WorkManager

Be aware, you'll have to manage runtime permissions on Manifest.permission.ACCESS_FINE_LOCATION & Manifest.permission.ACCESS_COARSE_LOCATION

Create the tracker

Constructor is defined as this

val locationTracker = LocationTracker(
    val minTimeBetweenUpdates: Long = 5 * 60 * 1000.toLong(),
    val minDistanceBetweenUpdates: Float = 100f,
    val shouldUseGPS: Boolean = true,
    val shouldUseNetwork: Boolean = true,
    val shouldUsePassive: Boolean = true
)

Add a listener

locationTracker.addListener(object: Listener {

	fun onLocationFound(location: Location) {
	}

	fun onProviderError(providerError: ProviderError) {
	}

});

Start and stop listening

locationTracker.startListening(context)
//and
locationTracker.stopListening()

Provide custom use

You can create a LocationTracker with custom parameters.

  • minTimeBetweenUpdates minimum time between two locations to respect before notifying the listeners in milliseconds). Default is 5 minutes
  • minDistanceBetweenUpdates minimum distance between two locations to respect before notifying the listeners in meters). Default is 100 meters
  • shouldUseGPS specifies if the tracker should use the GPS locations or not. Default is true
  • shouldUseNetwork specifies if the tracker should use the GPS locations or not. Default is true
  • shouldUsePassive specifies if the tracker should use the passive locations or not. Default is true

With the default parameters, when a location is found, the tracker will not call onLocationFound() again during 5 minutes. Moreover, if the distance between the new location and the older one is less than 100m, onLocationFound() will not be called.

Be aware that the priority of the time parameter is higher than the priority of the distance parameter. So even if the user has moved from 200km, the tracker will call onLocationFound() only after 30 minutes.

Cleaning

Be aware! A LocationTracker never stops running until you tell it to do so.

If the tracker is running in foreground and not in a service, it might be a good idea to link to the lifecycle

The stopListening method has an optional parameter cleanListeners that is false by default. (calling stopListening(false) is the same as calling stopListening()).

When calling stopListening we do not remove the listeners you've set, so they will be notified once you start listening again. But calling stopListening(true) will clear the list of registered listeners (same as calling removeListener for every registered listener).

tracker.addListener(listener)
tracker.startListening(context)
// listener will be notified
...
tracker.stopListening()
// listener won't receive updated
tracker.startListening(context)
// listener will be notified
...
tracker.stopListening(cleanListeners = true)
// listener won't receive updated for ever
tracker.startListening(context)
// listener won't be notified
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].