{"id":22737112,"url":"https://github.com/kibotu/geofencer","last_synced_at":"2025-04-14T04:33:02.731Z","repository":{"id":51381390,"uuid":"206807992","full_name":"kibotu/geofencer","owner":"kibotu","description":"Location tracking \u0026 geofencing the easy way. Supports background, killed app, rebooted device different update intervals.  ","archived":false,"fork":false,"pushed_at":"2023-12-06T12:51:26.000Z","size":949,"stargazers_count":132,"open_issues_count":5,"forks_count":29,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-27T18:21:35.930Z","etag":null,"topics":["android","android-library","background","boot","geofencing","hacktoberfest","hacktoberfest2023","kotlin","kotlin-android","kotlin-library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kibotu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-09-06T14:11:25.000Z","updated_at":"2025-02-24T11:55:49.000Z","dependencies_parsed_at":"2023-12-06T13:42:30.515Z","dependency_job_id":"531735a9-5941-4dc6-ab8d-70adf188858a","html_url":"https://github.com/kibotu/geofencer","commit_stats":null,"previous_names":["exozet/geolocator","kibotu/geofencer"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kibotu%2Fgeofencer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kibotu%2Fgeofencer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kibotu%2Fgeofencer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kibotu%2Fgeofencer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kibotu","download_url":"https://codeload.github.com/kibotu/geofencer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248821743,"owners_count":21166948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","background","boot","geofencing","hacktoberfest","hacktoberfest2023","kotlin","kotlin-android","kotlin-library"],"created_at":"2024-12-10T22:09:46.435Z","updated_at":"2025-04-14T04:33:02.695Z","avatar_url":"https://github.com/kibotu.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Geofencer \n[![Build Status](https://app.bitrise.io/app/62c5e7d6d14d57dd/status.svg?token=i0sTxq2L3WeD26_b77uA5A)](https://app.bitrise.io/app/62c5e7d6d14d57dd) [![](https://jitpack.io/v/kibotu/Geolocator.svg)](https://jitpack.io/#kibotu/Geolocator)\n[![](https://jitpack.io/v/exozet/Geolocator/month.svg)](https://jitpack.io/#exozet/Geolocator) [![Hits-of-Code](https://hitsofcode.com/github/exozet/Geolocator)](https://hitsofcode.com/view/github/exozet/Geolocator)\n[![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=15) [![Gradle Version](https://img.shields.io/badge/gradle-8.5-green.svg)](https://docs.gradle.org/current/release-notes) [![Kotlin](https://img.shields.io/badge/kotlin-1.9.21-green.svg)](https://kotlinlang.org/) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Geolocator-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/7860)\n\nConvenience library to receive user location updates and geofence events with minimal effort.\n\n### Features\n\n- supports Android 14\n- receive updates on background\n- receive updates if app got killed\n- geofence updates (dwell, enter, exit)\n- location updates\n- configurable update intervals\n\n![sample.gif](sample.gif)\n     \n### Requirements\n\n1. Location permissions in [*AndroidManifest.xml*](app/src/main/AndroidManifest.xml#L5-L9)\n\n\t    \u003cuses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /\u003e\n   \t \t\u003cuses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /\u003e\n   \t \t\u003cuses-permission android:name=\"android.permission.ACCESS_BACKGROUND_LOCATION\" /\u003e\n   \t \t\n2. Google maps api key\n\n\t\t\u003cstring name=\"google_maps_key\" templateMergeStrategy=\"preserve\" translatable=\"false\"\u003eYOUR_KEY\u003c/string\u003e\n\t\n### How to use\n\n### Geofence\n\n1. Create [Receiver](app/src/main/kotlin/com/sprotte/geolocator/demo/kotlin/NotificationWorker.kt)\n\n```kotlin\nclass NotificationWorker : GeoFenceUpdateModule() {\n\t\n    override fun onGeofence(geofence: Geofence) {\n    \tTimber.v(, \"onGeofence $geofence\")\n    }\n}\n```\n\n2. [Start geofence tracking](app/src/main/java/com/sprotte/geolocator/demo/kotlin/MainActivity.kt#L30-L39)\n\n```kotlin\nval geofence = Geofence(\n    id = UUID.randomUUID().toString(),\n    latitude = 51.0899232,\n    longitude = 5.968358,\n    radius = 30.0,\n    title = \"Germany\",\n    message = \"Entered Germany\",\n    transitionType = GEOFENCE_TRANSITION_ENTER\n)\n    \nGeofencer(this).addGeofenceWorker(geofence, NotificationWorker::class.java) { /* successfully added geofence */ }\n```\n### Location Tracker\nTODO: replace with worker\n1. Create [Receiver](app/src/main/java/com/sprotte/geolocator/demo/kotlin/LocationTrackerWorker.kt)\n\n```kotlin\nclass LocationTrackerWorker : LocationTrackerUpdateModule() {\n\n\toverride fun onLocationResult(locationResult: LocationResult) {  \n\t\tLog.v(GeoFenceIntentService::class.java.simpleName, \"onLocationResult $location\")\n  }\n}\n```\n\n2. [Start tracking](app/src/main/java/com/sprotte/geolocator/demo/kotlin/MainActivity.kt#L44-L45)\n\n```kotlin\nLocationTracker.requestLocationUpdates(this, LocationTrackerWorker::class.java)\n```\n\n4. Stop tracking\n\n```kotlin\nLocationTracker.removeLocationUpdates(requireContext())\n```\n\n### How to use in Java\n\n### Geofence\n\n1. Create [Receiver](app/src/main/java/com/sprotte/geolocator/demo/java/NotificationWorker.java)\n\n```java\npublic class NotificationWorker extends GeoFenceUpdateModule {\n\t\n\t@Override\n\tpublic void onGeofence(@NotNull Geofence geofence) {\n    \tTimber.d(\"onGeofence \" + geofence);\n   \t}\n}\n```\n\n2. [Start geofence tracking](app/src/main/java/com/sprotte/geolocator/demo/java/AddGeoFenceActivity.java#L47-L56)\n\n```java\nGeofence geofence = new Geofence(\n        UUID.randomUUID().toString(),\n        51.0899232,\n        5.968358,\n        30.0,\n        \"Germany\",\n        \"Entered Germany\",\n        GEOFENCE_TRANSITION_ENTER);\nGeofencer geofencer = new Geofencer(this);\ngeofencer.addGeofenceWorker(geofence, NotificationWorker.class,\n   \t () -\u003e /* successfully added geofence */ Unit.INSTANCE);        \t \n```\n### Location Tracker\n\n1. Create [Receiver](app/src/main/java/com/sprotte/geolocator/demo/java/LocationTrackerWorker.java)\n\n```java\npublic class LocationTrackerWorker extends LocationTrackerUpdateModule {\n\n    @Override\n    public void onLocationResult(@NotNull LocationResult location) {\n\t\n        Log.v(GeoFenceIntentService.class.getSimpleName(), \"onLocationResult \" + location);\t\t        );\n    }\n}\n```\n\n2. [Start tracking](https://github.com/exozet/Geolocator/blob/master/app/src/main/java/com/sprotte/geolocator/demo/java/AddGeoFenceActivity.java#L65-L68)\n\n```java\nLocationTracker.INSTANCE.requestLocationUpdates(this, LocationTrackerWorker.class);\n```\n\n4. Stop tracking\n\n```java\nLocationTracker.INSTANCE.removeLocationUpdates(this);\n```\n\n### How to install\n\n#### jCenter / mavenCentral\n\n\timplementation 'com.sprotte:Geolocator:latest'\n\n#### or Jiptack\n\n##### Step 1. Add the JitPack repository to your build file\n\nAdd it in your root build.gradle at the end of repositories:\n\n\tallprojects {\n\t\trepositories {\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n##### Step 2. Add the dependency\n\n\tdependencies {\n\t\timplementation 'com.github.exozet:Geolocator:latest'\n\t\timplementation 'com.google.android.gms:play-services-location:17.0.0'\n\t}\n\n### Configuration\n\nDefault Location tracking update intervals can be overriden, by adding following parameter into your _app/res/_ - folder, e.g. [**app/res/config.xml**](app/src/main/res/values/config.xml#L4-L7)\n\n``` xml\n    \u003c!-- Location Tracker --\u003e\n    \u003cinteger name=\"location_update_interval_in_millis\"\u003e0\u003c/integer\u003e\n    \u003cinteger name=\"location_fastest_update_interval_in_millis\"\u003e0\u003c/integer\u003e\n    \u003cinteger name=\"location_max_wait_time_interval_in_millis\"\u003e0\u003c/integer\u003e\n    \u003cinteger name=\"location_min_distance_for_updates_in_meters\"\u003e0\u003c/integer\u003e\n\n    \u003c!-- Geofencer --\u003e\n    \u003cinteger name=\"loitering_delay\"\u003e1\u003c/integer\u003e\n    \u003cinteger name=\"notification_responsiveness\"\u003e1\u003c/integer\u003e\n    \u003cinteger name=\"expiration_duration\"\u003e-1\u003c/integer\u003e // -1 == NEVER_EXPIRE\n```\n\nYou can also set this values at runtime in some step before call method `requestLocationUpdates`\n\n``` java\n    int interval = 1000;\n    int fastestInterval = 2000;\n    int priority = LocationRequest.PRIORITY_HIGH_ACCURACY;\n    int maxWaitTime = 10000;\n    int smallestDisplacement = 20;\n\n    LocationTrackerParams locationTrackerParams = new LocationTrackerParams(\n            interval, fastestInterval, priority, maxWaitTime, smallestDisplacement);\n\n    LocationTracker.INSTANCE.requestLocationUpdates(this, LocationTrackerService.class, locationTrackerParams);\n```\n\u003e 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.\n\n### Known Issues\n\n- does not work when in doze mode [#2](https://github.com/exozet/Geolocator/issues/2)\n\n\n### Contributors\n\n[Jan Rabe](jan.rabe@exozet.com)\n\n[Paul Sprotte](paul.sprotte@exozet.com)\n\n[AgnaldoNP] (https://github.com/AgnaldoNP)\n\n[Mohammed Khalid Hamid](https://github.com/khalid64927)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkibotu%2Fgeofencer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkibotu%2Fgeofencer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkibotu%2Fgeofencer/lists"}