HyperTrackDocs

Expo

Expo HyperTrack SDK is an Expo plugin for React Native wrapper around the native iOS and Android SDKs that allows to integrate them into Expo apps.

Requirements

Requirements for React Native

Basic integration

Updating the SDK? Check out the React Native and Expo changelogs to see what's changed.

Add HyperTrack SDK to your project

Install NPM dependencies

npx expo install hypertrack-sdk-expo \
  hypertrack-sdk-react-native \
  hypertrack-sdk-react-native-plugin-android-location-services-google \
  hypertrack-sdk-react-native-plugin-android-activity-service-google \
  hypertrack-sdk-react-native-plugin-android-push-service-firebase

Add HyperTrack Expo plugin to the app

Add hypertrack-sdk-expo to plugins array of your app.json or app.config.js:

{
  "expo": {
    "plugins": [
      [
        "hypertrack-sdk-expo",
        {
          "publishableKey": "YourPublishableKey", // find this in the HyperTrack dashboard Setup page
          "locationPermission": "<APP> needs permission to use location features for <REASON>..",
          "motionPermission": "<APP> needs permission to use motion features for <REASON>.."
        }
      ]
    ]
  }
}

iOS requires specifying permission purpose strings in Info.plist for app to build. You can use plugin parameters described above to set the strings. Every time you change the props or plugins, you'll need to rebuild (and prebuild) the native app.

  • locationPermission (string): Sets NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription
  • motionPermission (string): Sets NSMotionUsageDescription

Other plugin parameters:

  • publishableKey (string): Your HyperTrack publishable key. Required.
  • allowMockLocation (boolean): Sets HyperTrackAllowMockLocation (see SDK configuration). Default: false.
  • foregroundNotificationTitle, foregroundNotificationText (string): Title and text of the Android foreground service notification.
  • proxyDevicePushTokenCall (boolean): If iOS devices are missing the push token, set this to true. The plugin then passes the device token from the AppDelegate to the HyperTrack SDK as soon as iOS provides it. Default: false.
  • appTerminationNotification (boolean, iOS) enables the reminder to reopen the app. It defaults to false.

Set up silent push notifications

Set up for push notifications for Expo

Manual Setup

For bare workflow projects, you can follow the manual setup guide for React Native.

Set the publishable key

Get your publishable key from the Setup page.

Set the publishableKey parameter of the hypertrack-sdk-expo config plugin.

Set Worker Handle

To link a Worker with the device you should set the worker handle:

HyperTrack.setWorkerHandle("user_id") // unique user identifier

See Worker Setup guide for more information.

Grant the permissions to the app

Grant the permissions to the app (React Native)

Start tracking

Now the app is ready to be tracked from the cloud.

Follow the Track Work tutorial to learn how to control device tracking from your backend.

Dashboard

Once your app is running, go to the dashboard where you can see a list of all your devices and their live location with ongoing activity on the map.

Remind workers to reopen the app on iOS

If a worker swipes up on your app’s preview in the App Switcher, tracking can stop. The HyperTrack SDK can remind them to reopen your app. Once they do, tracking can resume in the background, even if they switch apps or lock the screen.

When the worker is on the way to a scheduled job, your dispatchers can use the updated ETA to spot a potential delay. Reopening the app sooner also gives your operations team a more complete record of the worker’s route and stops.

A worker swipes the app away during a shift and taps a custom reminder to reopen it — open separately

When the worker swipes the app away, the SDK can schedule a local notification if tracking is enabled, the worker is marked available, or they have an ongoing order. Your app needs the worker’s permission to show alerts, even if you already set up silent push notifications.

The reminder is off by default. With hypertrack-sdk-expo 7.1.0 or later and hypertrack-sdk-react-native 14.3.0 or later, add this option alongside publishableKey in the hypertrack-sdk-expo entry of app.json or app.config.js.

"appTerminationNotification": true

To customize the title or message, set appTerminationNotificationTitle or appTerminationNotificationBody to a string in the same plugin options. Apply the changes with Expo Prebuild and rebuild your iOS app.

See the React Native guide for other recommended steps.

Reference

Reference (React Native)

SDK integration examples

To learn more about SDK integration examples, you may visit these resources:

Support

Email help@hypertrack.com.

On this page