Adds a new geotag. Check Shift tracking and Clock In/Out tagging docs to learn how to use Order handle and Order status params.
const orderHanle = "test_order";
const orderStatus = {
type: "orderStatusCustom",
value: "my_order_status",
};
const data = {
test_object: {
test_key1: "test_value1",
},
};
const result = await hyperTrack.addGeotag(orderHanle, orderStatus, data);
Name | Type | Description |
---|---|---|
orderHanle | String | Order handle |
orderStatus | Object | OrderStatus |
geotagData | Object | Geotag data |
Result<Location, LocationError>
Adds a new geotag with expected location. Check Shift tracking and Clock In/Out tagging docs to learn how to use Order handle and Order status params.
const orderHandle = "test_order";
const orderStatus = {
type: "orderStatusCustom",
value: "my_order_status",
};
const data = {
test_object: {
test_key1: "test_value1",
},
};
const expectedLocation = {
latitude: 37.33182,
longitude: -122.03118,
};
let result = await hyperTrack.addGeotagWithExpectedLocation(
orderHandle,
orderStatus,
data,
expectedLocation
);
Name | Type | Description |
---|---|---|
orderHanle | String | Order handle |
orderStatus | Object | OrderStatus |
geotagData | Object | Geotag data |
expectedLocation | Location | Expected location object |
Result<LocationWithDeviation, LocationError>
Returns a string that is used to uniquely identify the device
let result = await hyperTrack.getDeviceId();
String
Returns a list of errors that blocks SDK from tracking
let result = await hyperTrack.getErrors();
Reflects availability of the device for the Nearby search
let result = await hyperTrack.getIsAvailable();
Boolean
Reflects the tracking intent for the device
let result = await hyperTrack.getIsTracking();
Boolean
Reflects the current location of the user or an outage reason
let result = await hyperTrack.getLocation();
Result<Location, LocationError>
Gets the metadata that is set for the device
let result = await hyperTrack.getMetadata();
Object
Gets the name that is set for the device
let result = await hyperTrack.getName();
String
Requests one-time location update and returns the location once it is available, or error.
Only one locate subscription can be active at a time. If you re-subscribe, the old subscription will be automaticaly removed.
This method will start location tracking if called, and will stop it when the location is received or the subscription is cancelled. If any other tracking intent is present (e.g. isAvailable is set to true
), the tracking will not be stopped.
const subscription = HyperTrack.locate(location => {
...
})
// to unsubscribe
subscription.remove()
Name | Type | Description |
---|---|---|
callback | Function | Callback that will be called when the location is received or an error occurs, the callback param is Result<Location, [HyperTrackError]> |
Sets the availability of the device for the Nearby search
hyperTrack.setIsAvailable(true);
Name | Type | Description |
---|---|---|
isAvailable | Boolean | True when is available or false when unavailable |
Sets the tracking intent for the device
hyperTrack.setIsTracking(true);
Name | Type | Description |
---|---|---|
isTracking | Boolean | Whether the user's movement data is getting tracked or not. |
Sets the metadata for the device
hyperTrack.setMetadata({
test_object: {
test_key1: "test_value1",
},
});
Name | Type | Description |
---|---|---|
metadata | Object | Metadata JSON |
Sets the name for the device
hyperTrack.setName("Test name");
Name | Type | Description |
---|---|---|
name | String | Name |
{
"type": "success",
"value": Success
}
{
"type": "failure",
"value": Failure
}
Tracking is not started (adding geotags is not possible)
{
"type": "notRunning
}
SDK is not initialized yet (no location data to add geotag)
{
"type": "starting
}
There was an outage while getting the location data
{
"type": "hyperTrackError",
"value": HyperTrackError
}
enum HyperTrackError {
/**
* The SDK was remotely blocked from running.
*/
blockedFromRunning = 'blockedFromRunning',
/**
* The publishable key is invalid.
*/
invalidPublishableKey = 'invalidPublishableKey',
/**
* The user enabled mock location app while mocking locations is prohibited.
*/
locationMocked = 'location.mocked',
/**
* The user disabled location services systemwide.
*/
locationServicesDisabled = 'location.servicesDisabled',
/**
* [Android only] The device doesn't have location services.
*/
locationServicesUnavailable = 'location.servicesUnavailable',
/**
* GPS satellites are not in view.
*/
locationSignalLost = 'location.signalLost',
/**
* [Android only] The SDK wasn't able to start tracking because of the limitations imposed by the OS.
* The exempt from background execution conditions weren't met.
* {@link https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions}
*/
noExemptionFromBackgroundStartRestrictions = 'noExemptionFromBackgroundStartRestrictions',
/**
* The user denied location permissions.
*/
permissionsLocationDenied = 'permissions.location.denied',
/**
* Can’t start tracking in background with When In Use location permissions.
* SDK will automatically start tracking when app will return to foreground.
*/
permissionsLocationInsufficientForBackground = 'permissions.location.insufficientForBackground',
/**
* [iOS only] The user has not chosen whether the app can use location services.
*/
permissionsLocationNotDetermined = 'permissions.location.notDetermined',
/**
* [iOS only] The app is in Provisional Always authorization state, which stops sending locations when app is in background.
*/
permissionsLocationProvisional = 'permissions.location.provisional',
/**
* The user didn't grant precise location permissions or downgraded permissions to imprecise.
*/
permissionsLocationReducedAccuracy = 'permissions.location.reducedAccuracy',
/**
* [iOS only] The app is not authorized to use location services.
*/
permissionsLocationRestricted = 'permissions.location.restricted',
/**
* [Android only] The user denied notification permissions needed to display a persistent notification
* needed for foreground location tracking.
*/
permissionsNotificationsDenied = 'permissions.notifications.denied',
}
{
"latitude": Double,
"longitude": Double,
}
{
"location": Location,
"deviation": Double,
}
{
"type": "orderStatusClockIn"
}
{
"type": "orderStatusClockOut"
}
{
"type": "orderStatusCustom",
"value": String
}