public class HyperTrackViews extends Object
Modifier and Type | Method and Description |
---|---|
void |
getDeviceMovementStatus(String deviceId,
<any> callback)
Retrieve latest snapshot of device state, that is tracked by
HyperTrack SDK.
|
static HyperTrackViews |
getInstance(android.content.Context context,
String publishableKey)
Main entry point to views SDK.
|
void |
getTrip(String tripId,
QueryResultHandler<Trip> handler)
Get full trip object by its id
|
void |
stopAllUpdates()
Stops all the updates, that were scheduled for this SDK instance.
|
void |
subscribeToDeviceUpdates(String deviceId,
DeviceUpdatesHandler deviceUpdatesHandler)
Use this to subscribe to real-time status updates for given device status.
|
void |
subscribeToDeviceUpdates(String deviceId,
String tripId,
DeviceUpdatesHandler deviceUpdatesHandler)
Use this to subscribe to real-time status updates for given device status.
|
void |
unsubscribeFromDeviceUpdates(DeviceUpdatesHandler deviceUpdatesHandler)
Stop receiving updates for the specified deviceUpdatesHandler.
|
void |
unsubscribeFromDeviceUpdates(String deviceId)
Stop receiving updates for the specified device.
|
public static HyperTrackViews getInstance(android.content.Context context, String publishableKey) throws IllegalArgumentException, NullPointerException
context
- reference to application contextpublishableKey
- api key from HyperTrack. You can get it at
dashboard.IllegalArgumentException
- if empty publishableKey passed as an argument.NullPointerException
- if context or publishableKey is null.public void subscribeToDeviceUpdates(String deviceId, DeviceUpdatesHandler deviceUpdatesHandler) throws IllegalArgumentException, NullPointerException
deviceId
- identifier of device that you're subscribing for.deviceUpdatesHandler
- listener (callback) that will receive status updates.IllegalArgumentException
- if deviceId is an empty string.NullPointerException
- if deviceId or deviceUpdatesHandler is null.unsubscribeFromDeviceUpdates(String)
,
stopAllUpdates()
public void subscribeToDeviceUpdates(String deviceId, String tripId, DeviceUpdatesHandler deviceUpdatesHandler) throws IllegalArgumentException, NullPointerException
deviceId
- identifier of device that you're subscribing for.tripId
- identifier of trip, that would be used to provide updates (updates from other
trips won't be passed to callback).deviceUpdatesHandler
- listener (callback) that will receive status updates.IllegalArgumentException
- if deviceId or tripId is empty.NullPointerException
- if any of its arguments is null.unsubscribeFromDeviceUpdates(String)
,
stopAllUpdates()
public void stopAllUpdates()
public void unsubscribeFromDeviceUpdates(String deviceId) throws IllegalArgumentException, NullPointerException
deviceId
- identifier of device that you're subscribing for.IllegalArgumentException
- if device id is an empty string.NullPointerException
- if deviceId is null.stopAllUpdates()
,
subscribeToDeviceUpdates(String, DeviceUpdatesHandler)
public void unsubscribeFromDeviceUpdates(DeviceUpdatesHandler deviceUpdatesHandler) throws NullPointerException
deviceUpdatesHandler
- instance of DeviceUpdatesHandler with which you have subscribed.NullPointerException
- if deviceUpdatesHandler is nullstopAllUpdates()
,
subscribeToDeviceUpdates(String, DeviceUpdatesHandler)
public void getDeviceMovementStatus(String deviceId, <any> callback) throws IllegalArgumentException, NullPointerException
deviceId
- identifier of devicecallback
- MovementStatus
consumer that will receive latest state snapshot
or null, if error happens.IllegalArgumentException
- if deviceId is an empty string.NullPointerException
- if any of its arguments is null.public void getTrip(String tripId, QueryResultHandler<Trip> handler) throws IllegalArgumentException, NullPointerException
tripId
- lowercased uuid of requested triphandler
- callback object to deliver query resultIllegalArgumentException
- if tripId is empty stringNullPointerException
- if tripId or handler is null