Skip to content

deadlyprince/react-native-sdk-onboarding

 
 

Repository files navigation

react-native-sdk-onboarding

App link: https://github.com/hypertrack/react-native-sdk-onboarding

Install the SDK - 1

Compatibility The module works with React Native 0.41.+

In your project directory, run the bash commands to install the React Native module and link it to your project files.

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

Install the SDK - 2

Getting Started Android

  1. Upgrade compileSdkVersion, buildToolsVersion, support library version For the Android SDK, edit the build.gradle file in your android/app directory
  1. Adds maven dependency for Google Libraries For the Android SDK, edit the build.gradle file in your android directory

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            jcenter()
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
            classpath 'com.google.gms:google-services:3.1.0'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            mavenLocal()
            jcenter()
            maven {
                // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                url "$rootDir/../node_modules/react-native/android"
            }
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
        }
    }

Install the SDK - 3

Configure your publishable key and initialise the SDK in the constructor method of your Component class. This needs to be done only once in the app lifecycle.

Account keys Sign up to get account keys if you haven't already.

Identify device

The SDK needs a User object to identify the device. The SDK has a convenience method getOrCreateUser() to lookup an existing user using a unique identifier (called lookupId) or create one if necessary.

Method parameters

  • userName - Name of the user entity
  • phone - Phone number of the user entity
  • lookupId - Unique identifier for your user

Use this API in conjunction to your app's login flow, and call getOrCreate at the end of a successful login flow. This API is a network call, and needs to be done only once in the user session lifecycle.

Waiting for your app to run

Start tracking

Use the startTracking() method to start tracking. Once the user starts tracking, you can see Trips and Stops of the user.

This is a non-blocking API call, and will also work when the device is offline.

Waiting for your app to run

View on the dashboard View the user's trips and stops here.

Stop tracking

Use the stopTracking() method to stop tracking. This can be done when the user logs out.

Ready to deploy! Your React Native app is all set to be deployed. As your users update and log in, their live location will be visualized on this dashboard.

Next steps

  • Add team members to the HyperTrack dashboard
  • Follow one of our use-case tutorials to build your live location feature

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 42.9%
  • Objective-C 29.7%
  • Python 11.7%
  • Java 9.6%
  • Ruby 5.5%
  • Shell 0.6%