Installing the SDK

This guide will help you setup the React Native module in your application. The module is built on top of native iOS and Android SDKs, which collect locations and related data in a battery efficient way. The module exposes methods to start and stop data collection, and interact with the HyperTrack APIs.

In case you are not using React Native, you can refer to the iOS or Android versions. If you're looking for an example integration, use the example react native application.

[info] Step-By-Step Onboarding

Setting up HyperTrack React Native SDK in your app?

We recommend you try our new interactive step-by-step onboarding

React Native Onboarding

Install the dependency

In your project directory, install and link the module package from npm.

$ npm install react-native-hypertrack --save
$ react-native link react-native-hypertrack

If you are using an older version of React Native that does not support link, you can manually link libraries.

Setup Android dependencies

To use the HyperTrack Android SDKs, the following urls need to be added to your android/build.gradle file. This will configure the repository urls for the SDKs.

allprojects {
    repositories {
        ...
        maven { url 'http://hypertrack-android-sdk.s3-website-us-west-2.amazonaws.com/' }
        maven { url 'https://repo.eclipse.org/content/repositories/paho-releases/' }
    }
}

If you have some issues with Android, some common troubleshooting is available here.

Setup iOS dependencies

  1. The native iOS SDKs need to be setup using Cocoapods. In your project's ios directory, create a Podfile.

     $ cd ios
     $ pod init
    
  2. Edit the Podfile to include HyperTrack as a dependency for your project, and then install the pod.

     $ cat Podfile
     target 'YourApp' do
       pod 'HyperTrack'
     end
    
     $ pod install
    
  3. Now, open the iOS project with the .xcworkspace file in Xcode, and add the HyperTrack.framework file to the linked frameworks and libraries section.

Configure the API key

To configure the SDK, set the publishable key. This can be done in the constructor of your component class.

import RNHyperTrack from 'react-native-hypertrack';

export default class MyApp extends Component {
  constructor() {
    super();
    // Initialize HyperTrack wrapper
    RNHyperTrack.initialize('YOUR_PK_TOKEN');
  }
}

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""