Constructors

Properties

locateSubscription: undefined | Subscription

Methods

  • If disallowed, the HyperTrack platform will display and outage if mocked location is detected.

    Returns Promise<boolean>

  • Returns a string that is used to uniquely identify the device

    Returns Promise<string>

    Device ID

  • Reflects availability of the device for the Nearby search

    Returns Promise<boolean>

    true when is available or false when unavailable

  • Reflects the tracking intent for the device

    Returns Promise<boolean>

    Whether the user's movement data is getting tracked or not.

  • Gets the metadata that is set for the device

    Returns Promise<Object>

    Metadata JSON

  • Gets the name that is set for the device

    Returns Promise<string>

    Device name

  • Orders assigned to the worker

    Returns Promise<Map<string, Order>>

  • A primary identifier that uniquely identifies the worker outside of HyperTrack. Example: email, phone number, database id It is usually obtained and set when the worker logs into the app. Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and avoid unintentional tracking.

    Returns Promise<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.

    Parameters

    Returns Subscription

    Subscription

    Example

    const subscription = HyperTrack.locate(location => {
    ...
    })

    // to unsubscribe
    subscription.remove()
  • Allows mocking location data.

    Check the Test with mock locations guide for more information.

    To avoid issues related to race conditions in your code use this API only if modifying the compiled HyperTrackAllowMockLocation AndroidManifest.xml/Info.plist value is insufficient for your needs. Example: if for some reason you aren't able to recompile with HyperTrackAllowMockLocation set to YES/true for your prod app QA mock location tests and need to set up the value in runtime.

    Parameters

    • allow: boolean

    Returns Promise<void>

  • Sets the availability of the device for the Nearby search

    Parameters

    • isAvailable: boolean

      true when is available or false when unavailable

    Returns Promise<void>

  • Sets the tracking intent for the device

    Parameters

    • isTracking: boolean

    Returns Promise<void>

  • Sets the metadata for the device

    Parameters

    • data: Object

      Metadata JSON

    Returns Promise<void>

  • Sets the name for the device

    Parameters

    • name: string

    Returns Promise<void>

  • A primary identifier that uniquely identifies the worker outside of HyperTrack. Example: email, phone number, database id It is usually obtained and set when the worker logs into the app. Set it to an empty string "" when the worker logs out of the app to un-bind the device from the worker and avoid unintentional tracking.

    Parameters

    • workerHandle: string

    Returns void

  • Subscribe to tracking errors

    Parameters

    • listener: ((errors) => void)

    Returns Subscription

    Subscription

    Example

    const subscription = HyperTrack.subscribeToErrors(errors => {
    errors.forEach(error => {
    // ... error
    })
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to availability changes

    Parameters

    • listener: ((isAvailable) => void)
        • (isAvailable): void
        • Parameters

          • isAvailable: boolean

          Returns void

    Returns Subscription

    Subscription

    Example

    const subscription = HyperTrack.subscribeToIsAvailable(isAvailable => {
    if (isAvailable) {
    // ... ready to go
    }
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to tracking intent changes

    Parameters

    • listener: ((isTracking) => void)
        • (isTracking): void
        • Parameters

          • isTracking: boolean

          Returns void

    Returns Subscription

    Subscription

    Example

    const subscription = HyperTrack.subscribeToIsTracking(isTracking => {
    if (isTracking) {
    // ... ready to go
    }
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to location changes

    Parameters

    Returns Subscription

    Subscription

    Example

    const subscription = HyperTrack.subscribeToLocation(location => {
    ...
    })

    // later, to stop listening
    subscription.remove()
  • Subscribe to changes in the orders assigned to the worker

    Parameters

    • listener: ((orders) => void)
        • (orders): void
        • Parameters

          • orders: Map<string, Order>

          Returns void

    Returns Subscription

    Subscription

    Example

    const subscription = HyperTrack.subscribeToOrders(orders => {
    ...
    })

    // later, to stop listening
    subscription.remove()