@dolphintechnologies/react-native-move-sdk
TypeScript icon, indicating that this package has built-in type declarations

2.7.1-alpha.9 • Public • Published

react-native-move-sdk

React Native library for MOVE SDK - please see https://docs.movesdk.com/move/ for features and details about the MOVE SDK.

Installation

npm install react-native-move-sdk --save
#or
yarn add react-native-move-sdk

iOS

Add to the AppDelegate.m file

#import <ReactMoveSDK/MoveSdk.h>
...
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [RCTMoveSdk initIfPossibleWithLaunchOptions:launchOptions];
  return YES;
}

Android

Add the DolphinSDK repository to the build.gradle file

// android/build.gradle
allprojects {
	repositories {
		maven {
			url "https://dolphin.jfrog.io/artifactory/move-sdk-libs-release"
			content {
				includeGroup "io.dolphin.move"
			}
		}
	}
}

Add to the MainApplication.java file

import in.dolph.move.sdk.NativeMoveSdkWrapper;
...
public class MainApplication extends Application implements ReactApplication {
	private NativeMoveSdkWrapper sdkWrapper;
	...
	public void onCreate() {
		super.onCreate();
		sdkWrapper = NativeMoveSdkWrapper.getInstance(this);
		sdkWrapper.init(this);
		...
	}
}

Usage

See https://docs.movesdk.com/move/sdk-1/api-interface/react-native/intialization

import MoveSdk from 'react-native-move-sdk';
...
const tripChannel = {
	id: 'CT',
	name: 'Trips',
	description: 'Trips Description',
};
const recognitionNotification: NotificationConfig = {
	title: 'MOVE SDK Trip Recognition',
	text: 'SDK trip recognition is running',
	channel: tripChannel,
};
const tripNotification: NotificationConfig = {
	title: 'MOVE SDK Trip Running',
	text: 'SDK is recording your trip',
	channel: tripChannel,
};

const auth = {
	userId: ...,
	accessToken: ...,
	refreshToken: ...,
	projectId: ...,
};

export const CONFIG: MoveSdkConfig = {
	timelineDetectionServices: ['DRIVING', 'BICYCLE', 'PUBLIC_TRANSPORT', 'WALKING'],
	drivingServices: ['DISTRACTION_FREE_DRIVING', 'DRIVING_BEHAVIOUR'],
	walkingServices: []
};

export const ANDROID_CONFIG: MoveSdkAndroidConfig = {
	notifications: {
		recognitionNotification,
		tripNotification,
	}
};

MoveSdk.setup(CONFIG, auth, ANDROID_CONFIG)

Methods

See: https://docs.movesdk.com/move/sdk-1/api-interface/react-native/services

Required permissions description ios and android...

MoveSdk.getState();
MoveSdk.resolveError();
MoveSdk.getErrors();
MoveSdk.getWarnings();
MoveSdk.startAutomaticDetection();
MoveSdk.stopAutomaticDetection();
MoveSdk.initiateAssistanceCall();
MoveSdk.shutdown();

...

Listener

MoveSdk.addSdkStateListener((state: SdkState) => {
	...
});

MoveSdk.addTripStateListener((state: TripState) => {
	...
});

MoveSdk.addAuthStateListener((event: AuthStateEvent) => {
	...
});

MoveSdk.addAppEventListener((event: string) => {
	...
});

MoveSdk.addWarningsListener((warnings: ErrorListType) => {
	...
});

MoveSdk.addErrorsListener((errors: ErrorListType) => {
	...
});

License

MIT

Package Sidebar

Install

npm i @dolphintechnologies/react-native-move-sdk

Repository

www.dolph.in

Homepage

www.dolph.in

Weekly Downloads

118

Version

2.7.1-alpha.9

License

MIT

Unpacked Size

321 kB

Total Files

55

Last publish

Collaborators

  • dolphintechnologies