HyperTrack

open class HyperTrack

Main interface to use HyperTrack Android SDK in your app. SDK allows you to track current device in real-time in almost no effort while having ready to use dashboard and backend infrastructure already build for a bunch of existing use-cases.

Usage:


        HyperTrack sdk = HyperTrack.getInstance(myPublishableKey)
                                   .setDeviceName("Elvis")
                                   .allowMockLocations()
                                   .addTrackingListener(this);

        Log.d(TAG, "HyperTrack device id is " + sdk.getDeviceID());

        sdk.start();

    

See our awesome quickstart for details.

Functions

Link copied to clipboard
Sets listener that will be notified when availability changes.
Link copied to clipboard
open fun addGeotag(@NonNull payload: Map<String, out Any>): GeotagResult
Convenience alias to addGeotag with null expected location.
open fun addGeotag(@NonNull payload: Map<String, out Any>, @Nullable expected: Location): GeotagResult
Creates geotag with configurable payload.
Link copied to clipboard
Sets listener that will be notified when tracking starts/stops or significant error occurred.
Link copied to clipboard
open fun allowMockLocations(): HyperTrack
Allows you to use location mocking software (e.g.
Link copied to clipboard
open fun backgroundTrackingRequirement(isRequired: Boolean): HyperTrack
Sets whether to request background location permission on Android 11 and later.
Link copied to clipboard
open fun enableDebugLogging()
Enables debug log output.
Link copied to clipboard
open fun getAvailability(): Availability
Gets current Availability status
Link copied to clipboard
open fun getBlockers(): Set<Blocker>
Link copied to clipboard
open fun getCurrentLocation(@NonNull receiver: AsyncResultReceiver<Location, OutageReason>)
Asynchronous access to the current device location.
Link copied to clipboard
open fun getDeviceID(): String
Link copied to clipboard
open fun getInstance(@NonNull publishableKey: String): HyperTrack
Entry point to SDK usage.
Link copied to clipboard
open fun getLatestLocation(): Result<Location, OutageReason>
Latest device location, that is known to HyperTrack SDK.
Link copied to clipboard
open fun isRunning(): Boolean
Link copied to clipboard
open fun isTracking(): Boolean
Link copied to clipboard
Removes listener or does nothing, if null was passed in as argument.
Link copied to clipboard
open fun requestPermissionsIfNecessary(): HyperTrack
Convenience method that will issue required permissions request dialog if necessary.
Link copied to clipboard
open fun setAvailability(availability: Availability)
Sets current Availability status
Link copied to clipboard
open fun setDeviceMetadata(@Nullable metaData: Map<String, Any>): HyperTrack
Sets current device data, that can be used for easier dashboard navigation or grouping of location data in tag groups style.
Link copied to clipboard
open fun setDeviceName(@Nullable name: String): HyperTrack
Sets current device name, that can be used for easier dashboard navigation.
Link copied to clipboard
open fun setTrackingNotificationConfig(@Nullable config: ServiceNotificationConfig): HyperTrack
Allows to to customize persistent notification elements.
Link copied to clipboard
open fun start(): HyperTrack
Starts tracking, if all requirements are met (permissions are granted and publisahble Key is validated).
Link copied to clipboard
open fun stop(): HyperTrack
Stops current tracking session.
Link copied to clipboard
open fun syncDeviceSettings(): HyperTrack
This method checks with HyperTrack cloud whether to start or stop tracking.