Constructors

Properties

locateSubscription: undefined | EmitterSubscription

Methods

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

    Returns Promise<string>

    Device ID

  • Returns Promise<string>

  • 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

  • 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 EmitterSubscription 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 EmitterSubscription

    EmitterSubscription

    Example

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

    // to unsubscribe
    subscription.remove()
  • Parameters

    • dynamicPublishableKey: string

    Returns void

  • Sets the availability of the device for the Nearby search

    Parameters

    • isAvailable: boolean

    Returns void

  • Sets the tracking intent for the device

    Parameters

    • isTracking: boolean

    Returns void

  • Sets the metadata for the device

    Parameters

    • data: Object

      Metadata JSON

    Returns void

  • Sets the name for the device

    Parameters

    • name: string

    Returns void

  • Subscribe to tracking errors

    Parameters

    • listener: ((errors) => void)

    Returns EmitterSubscription

    EmitterSubscription

    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 EmitterSubscription

    EmitterSubscription

    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 EmitterSubscription

    EmitterSubscription

    Example

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

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

    Parameters

    Returns EmitterSubscription

    EmitterSubscription

    Example

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

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