Location Tracking Library written in Kotlin to easy the process of location tracking. it's compatible with the latest Android API.
Add the following lines to the application:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
and for the other gradle file
dependencies {
implementation 'com.github.nikiizvorski:localsdk:v1.0'
// or
implementation(name: 'localsdk', ext:'aar')
// google
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
}
They are included automatically by the SDK manifest:
ACCESS_FINE_LOCATION, for location services
INTERNET and ACCESS_NETWORK_STATE, to send API requests
RECEIVE_BOOT_COMPLETED, to restore geofences on boot
Initialize the SDK in your Application class before calling any other methods. In onCreate(), call:
Local.initialize(publishableKey)
where publishableKey is a string containing your publishable API key.
Local().setUserId and Local().getUserId
Local().setTrackingPriority(Local.LocalPriority.RESPONSIVE), Local().setTrackingPriority(Local.LocalPriority.EFFICIENT)
Permission Request is done with the following method its done for user convinience. You have two methods:
Local().requestPermissions() and Local().checkSelfPermissions()
Once you have initialized the SDK, you have identified the user, and the user has granted permissions, you can track the user's location.
Local().trackOnce(add callback)
Local.SUCCESS: the request succeeded
Local.ERROR_PUBLISHABLE_KEY: the SDK was not initialized
Local.ERROR_PERMISSIONS: the user has not granted location permissions for the app
Tracking should work as expected in background also. This means that when your app is in background it will still send location updates to you but with a limited time frame a couple updates when possible. Its compolient with the newest APIs requirements.
Local().startTracking(add callback) and Local().stopTracking()
SDK size is 150kb and its ProGuard Friendly
Next to be added in the library would be Geofences. And maybe some improvements on specific use-case for Location Tracking on newer APIs
This is a test configuration for a SDK. It doesn't have a production setup. If you need production setup please let me know and i can do it depending on the services and end result that you need. Also architecture is to minimum for size and integration problems with other people dependecy management with Dagger etc...No need to exclude libraries after. That can be added also.