All Projects → exozet → Geolocator

exozet / Geolocator

Licence: mit
Location tracking & geofencing the easy way. Supports background, killed app, rebooted device different update intervals.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Geolocator

Hackbgrt
Windows boot logo changer for UEFI systems
Stars: ✭ 693 (+1055%)
Mutual labels:  boot
Multiple.js
Sharing background across multiple elements using CSS
Stars: ✭ 879 (+1365%)
Mutual labels:  background
Boot Figreload
Boot task providing live-reload using Fighweel client
Stars: ✭ 50 (-16.67%)
Mutual labels:  boot
Floppybird
Floppy Bird (OS)
Stars: ✭ 836 (+1293.33%)
Mutual labels:  boot
Fennel
A task queue library for Python and Redis
Stars: ✭ 24 (-60%)
Mutual labels:  background
Pmbootstrap
Repository has been moved! https://postmarketos.org/move.html#/pmbootstrap 🚚 🚚 🚚
Stars: ✭ 1,010 (+1583.33%)
Mutual labels:  boot
Cordova Background Geolocation Lt
The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
Stars: ✭ 600 (+900%)
Mutual labels:  background
Spring Cloud Stream Demo
Simple Event Driven Microservices with Spring Cloud Stream
Stars: ✭ 58 (-3.33%)
Mutual labels:  boot
Mac Linux Usb Loader
Boot Linux on your Mac, easily
Stars: ✭ 854 (+1323.33%)
Mutual labels:  boot
Multibootusb
Create multiboot live Linux on a USB disk...
Stars: ✭ 1,042 (+1636.67%)
Mutual labels:  boot
Update Background Locations
A sample iOs example that tracks background locations.
Stars: ✭ 7 (-88.33%)
Mutual labels:  background
Eager Image Loader
The eager-loading for image files on the web page that loads the files according to your plan. This differs from the lazy-loading, for example, this can be used to avoid that the user waits for the loading.
Stars: ✭ 22 (-63.33%)
Mutual labels:  background
Secure Boot
UEFI SecureBoot for ArchLinux
Stars: ✭ 48 (-20%)
Mutual labels:  boot
Arm now
arm_now is a qemu powered tool that allows instant setup of virtual machines on arm cpu, mips, powerpc, nios2, x86 and more, for reverse, exploit, fuzzing and programming purpose.
Stars: ✭ 719 (+1098.33%)
Mutual labels:  boot
Boot Cljs Test
Boot task to run ClojureScript tests.
Stars: ✭ 53 (-11.67%)
Mutual labels:  boot
Honeydew
Job Queue for Elixir. Clustered or Local. Straight BEAM. Optional Ecto. 💪🍈
Stars: ✭ 670 (+1016.67%)
Mutual labels:  background
Spring Boot
spring-boot 项目实践总结
Stars: ✭ 989 (+1548.33%)
Mutual labels:  boot
Boot Http
A simple HTTP serve task for the Boot build tool
Stars: ✭ 60 (+0%)
Mutual labels:  boot
Bootstrap
Tools to bootstrap micro computers
Stars: ✭ 55 (-8.33%)
Mutual labels:  boot
Debootstick
Generate a bootable live image from any Debian/Ubuntu filesystem tree.
Stars: ✭ 48 (-20%)
Mutual labels:  boot

Geofencer

Build Status Download Hits-of-Code API Gradle Version Kotlin Android Arsenal

Convience library to receive user location updates and geofence events with minimal effort.

Features:

  • supports Android-Q
  • receive updates on background
  • receive updates if app got killed
  • geofence updates (dwell, enter, exit)
  • location updates
  • configurable update intervals

sample.gif

Requirmenets

  1. Location permissions in AndroidManifest.xml

     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    
  2. Google maps api key

     <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY</string>
    

How to use

Geofence

  1. Create Receiver
class GeofenceIntentService : GeofenceIntentService() {
	
    override fun onGeofence(geofence: Geofence) {
    	Log.v(GeoFenceIntentService::class.java.simpleName, "onGeofence $geofence")	    
    }
}
  1. Add receiver to your manifest

     <service
         android:name=".kotlin.GeoFenceIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE" />
    
  2. Start geofence tracking

val geofence = Geofence(
    id = UUID.randomUUID().toString(),
    latitude = 51.0899232,
    longitude = 5.968358,
    radius = 30.0,
    title = "Germany",
    message = "Entered Germany",
    transitionType = GEOFENCE_TRANSITION_ENTER
)
    
Geofencer(this).addGeofence(geofence, GeoFenceIntentService::class.java) { /* successfully added geofence */ }

Location Tracker

  1. Create Receiver
class LocationTrackerService : LocationTrackerUpdateIntentService() {

	override fun onLocationResult(locationResult: LocationResult) {  
		Log.v(GeoFenceIntentService::class.java.simpleName, "onLocationResult $location")
  }
}
  1. Add receiver to manifest

     <service
         android:name=".kotlin.LocationTrackerService"
         android:permission="android.permission.BIND_JOB_SERVICE" />
    
  2. Start tracking

LocationTracker.requestLocationUpdates(this, LocationTrackerService::class.java)
  1. Stop tracking
LocationTracker.removeLocationUpdates(requireContext())

How to use in Java

Geofence

  1. Create Receiver
public class GeoFenceIntentService extends GeofenceIntentService {
	
	@Override
	public void onGeofence(@NotNull Geofence geofence) {
	
    	Log.v(GeoFenceIntentService.class.getSimpleName(), "onGeofence " + geofence);	    	
   	}
}
  1. Add receiver to your manifest

     <service
         android:name=".java.GeoFenceIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE" />
    
  2. Start geofence tracking

Geofence geofence = new Geofence(
        UUID.randomUUID().toString(),
        51.0899232,
        5.968358,
        30.0,
        "Germany",
        "Entered Germany",
        GEOFENCE_TRANSITION_ENTER);
Geofencer geofencer = new Geofencer(this);
geofencer.addGeofence(geofence, GeoFenceIntentService.class,
   	 () -> /* successfully added geofence */ Unit.INSTANCE);        	 

Location Tracker

  1. Create Receiver
public class LocationTrackerService extends LocationTrackerUpdateIntentService {

    @Override
    public void onLocationResult(@NotNull LocationResult location) {
	
        Log.v(GeoFenceIntentService.class.getSimpleName(), "onLocationResult " + location);		        );
    }
}
  1. Add receiver to manifest

     <service
         android:name=".java.LocationTrackerService"
         android:permission="android.permission.BIND_JOB_SERVICE" />
    
  2. Start tracking

LocationTracker.INSTANCE.requestLocationUpdates(this, LocationTrackerService.class);
  1. Stop tracking
LocationTracker.INSTANCE.removeLocationUpdates(this);

How to install

jCenter / mavenCentral

implementation 'com.sprotte:Geolocator:latest'

or Jiptack

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		maven { url 'https://jitpack.io' }
	}
}
Step 2. Add the dependency
dependencies {
	implementation 'com.github.exozet:Geolocator:latest'
	implementation 'com.google.android.gms:play-services-location:17.0.0'
}

Configuration

Default Location tracking update intervals can be overriden, by adding following parameter into your app/res/ - folder, e.g. app/res/config.xml

    <!-- Location Tracker -->
    <integer name="location_update_interval_in_millis">0</integer>
    <integer name="location_fastest_update_interval_in_millis">0</integer>
    <integer name="location_max_wait_time_interval_in_millis">0</integer>
    <integer name="location_min_distance_for_updates_in_meters">0</integer>

    <!-- Geofencer -->
    <integer name="loitering_delay">1</integer>
    <integer name="notification_responsiveness">1</integer>
    <integer name="expiration_duration">-1</integer> // -1 == NEVER_EXPIRE

You can also set this values at runtime in some step before call method requestLocationUpdates

    int interval = 1000;
    int fastestInterval = 2000;
    int priority = LocationRequest.PRIORITY_HIGH_ACCURACY;
    int maxWaitTime = 10000;
    int smallestDisplacement = 20;

    LocationTrackerParams locationTrackerParams = new LocationTrackerParams(
            interval, fastestInterval, priority, maxWaitTime, smallestDisplacement);

    LocationTracker.INSTANCE.requestLocationUpdates(this, LocationTrackerService.class, locationTrackerParams);

LocationTrackerParams is a open class for kotlin or a not final class for java, so if you don't need to setup all params you can extend it.

Known Issues

  • does not work when in doze mode #2

Contributors

Jan Rabe

Paul Sprotte

[AgnaldoNP] (https://github.com/AgnaldoNP)

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].