Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Android Views SDK

The Android Views SDK is used for getting live location and movement data for devices and trips directly to your Android app. This module subscribes to HyperTrack's GraphQL server end points to get data streams and then renders it in useful callbacks for app developers to build beautiful tracking experiences. This helps developers creating live location views go serverless. Their app users can directly get data securely and privately from the HyperTrack servers.

Integrate the Views SDK

Step 1. Add Views SDK

Add following lines to your applications build.gradle:

// Import the SDK within your repositories block
repositories {
    maven {
        name 'hypertrack'
        url ''

//Add HyperTrack Views SDK as a dependency
dependencies {
    implementation 'com.hypertrack:hypertrack-views:0.8.7'

Step 2. Instantiate

Pass Context reference to get SDK instance.

   HyperTrackViews hypertrackView = HyperTrackViews.getInstance(this, PUBLISHABLE_KEY);

Step 3. Get state

Get current state of tracked device

                                  new Consumer<MovementStatus>() {
                                      public void accept(MovementStatus movementStatus) {
                                          Log.d(TAG, "Got movement status data " + movementStatus);

In callback, that you pass as a second argument, you'll receive MovementStatus object that encapsulates various data describing device state. Check out docs for data that is available.

Step 4. Subscribe to updates

You can receive device state changes updates

   new DeviceUpdatesHandler() {
           public void onLocationUpdateReceived(@NonNull Location location) {
               Log.d(TAG, "onLocationUpdateReceived: " + location);

           public void onBatteryStateUpdateReceived(@BatteryState int i) {
               Log.d(TAG, "onBatteryStateUpdateReceived: " + i);

           public void onStatusUpdateReceived(@NonNull StatusUpdate statusUpdate) {
               Log.d(TAG, "onStatusUpdateReceived: " + statusUpdate);

           public void onTripUpdateReceived(@NonNull Trip trip) {
               Log.d(TAG, "onTripUpdateReceived: " + trip);


           public void onError(Exception exception, String deviceId) {
               Log.w(TAG, "onError: ", exception);


           public void onCompleted(String deviceId) {
               Log.d(TAG, "onCompleted: " + deviceId);


Likewise in case of one-time status query you'll receive updates object in a listener, that you pass into this method. Check out documentation for available update object properties. Make sure you've stop updates, once you're done since you can end up with leaked websocket otherwise.


You are all set

Frequently Asked Questions

Supported versions

Currently we do support all of the Android versions starting from API 19 (Android 4.4 Kit Kat)

Get device id

Device id is a way to reference particular device, that is tracked by HyperTrack SDK. Generally, it's your application logic which devices should be displayed and how to filter/prioritize/select the one you need to track. If you have doubts regarding how to integrate HyperTrack SDK - look into corresponding quickstart section. Once integration is done, device id can be obtained via HyperTrack.getDevcieid() call on initialized SDK.

Not Only Views in Views

Although view is associated with something, that should be visual, here it means view on data, that you retrieve from HyperTrack SDK. Tricky part is that application success nowadays is highly dependends on quality of user experience, that is hardly achievable without fine-grained tuning of UI elements. So using real-time data pushed to your device, you can build exactly the same views you really want. Anyway, ready to use UI elements will be added to upcoming library releases.

Track multiple devices

You can subscribe to more than one device by executing subscribeToDeviceUpdates multiple times with different device ids. Subscription updates consumer can be the same (e.g. map fragment), since each update has device id field for identification.

Trips Tracking

Each trip has a device id, for which it was created, pass that id to subscribeToDeviceUpdates and you'll receive all the trip recalculations and delays into onTripUpdateReceived callback.

Battery State Constants

Using enums in Android is discouraged, so we're using numerical values to represent BatteryState. Check out reference for exact values meaning.


Get HyperTrack data directly on your Android app to build views



No packages published