Expo

hypertrack-sdk-expo
hypertrack-sdk-react-native

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

Migrating from older versions? Check the Migration guide

Add HyperTrack SDK to your project

We constantly work on making our SDKs better, so make sure you have the latest version. You can get it in the changelog for our React Native library and Expo config plugin.

Install NPM dependencies

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

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"
      ]
    ]
  }
}

Configure permission purpose strings

iOS requires specifying permission purpose strings in Info.plist for app to build.

You can use plugin parameters described below 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

Edit hypertrack-sdk-expo item in your app.json or app.config.js:

{
  "expo": {
    "plugins": [
      [
        "hypertrack-sdk-expo",
        {
          "locationPermission": "PUT_YOUR_PERMISSION_HINT_MESSAGE_HERE",
        }
      ]
    ]
  }
}

Set up silent push notifications

The SDK has a bi-directional communication model with the server. This enables the SDK to run on a variable frequency model, which balances the fine trade-off between low latency tracking and battery efficiency, and improves robustness. This also enables HyperTrack Trips to start and stop tracking automatically when trip starts and ends. For this purpose, the iOS SDK uses APNs silent remote notifications and Android SDK uses FCM silent 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.

Add the publishable key as to hypertrack-sdk-expo plugin as a param:

{
  "expo": {
    "plugins": [
      [
        "hypertrack-sdk-expo",
        {
	  "locationPermission": "PUT_YOUR_PERMISSION_HINT_MESSAGE_HERE",
          "publishableKey": "YourPublishableKey",
        }
      ]
    ]
  }
}

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.

You will need the device id to start tracking, check the Identify devices section for instructions on how to get it.

Follow the Start Tracking 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.

Prepare for App Store and Google Play submission

Recommended additional steps

Recommended additional steps (React Native)

Migration Guide

Migration Guide (React Native)

Migration from hypertrack-sdk-expo plugin

motionPermission plugin param is removed (because the SDK doesn't need the Motion activity permission anymore).

Reference

Reference (React Native)

SDK integration examples

Quickstart Expo

Frequently Asked Questions

Frequently Asked Questions (React Native)