react-native-move-sdk
v2.19.1
Published
React Native library for MOVE SDK
Maintainers
Readme
react-native-move-sdk
React Native library for MOVE SDK - please see https://docs.movesdk.com/move-platform for features and details about the MOVE SDK.
Installation
npm install react-native-move-sdk --save
#or
yarn add react-native-move-sdkAndroid
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);
...
}
}iOS
The MOVE SDK is delivered via Swift Package Manager from
dolphin-technologies/MOVE-iOS-Packages.
The dependency is declared in this library's podspec, so a normal pod install
resolves and links it automatically — no manual Xcode package step is required.
Because the SDK is consumed as a Swift package, the iOS app must use dynamic frameworks. This is a one-time setup in your app:
Expo: add
expo-build-properties:{ "expo": { "plugins": [ ["expo-build-properties", { "ios": { "useFrameworks": "dynamic" } }] ] } }Bare React Native: add to
ios/Podfile:use_frameworks! :linkage => :dynamic
Note: forcing dynamic frameworks affects the whole app and may require adjustments for other native modules that assume static linking.
Expo
Add the config plugin to app.json / app.config.js. The Health extension
(HealthKit steps sync) is optional; include it only if you use the steps feature:
{
"expo": {
"plugins": [
["react-native-move-sdk", { "extensions": ["Health"] }]
]
}
}When Health is listed, the plugin embeds the DolphinMoveSDKHealth framework
(via SPM) and wires up the Android Health Connect permissions. Omit it to ship
without HealthKit support.
Usage
See https://docs.movesdk.com/move-platform/sdk/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,
};
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.setupWithCode(code: authCode, config: CONFIG, platformParams: ANDROID_CONFIG)Methods
See: https://docs.movesdk.com/move-platform/sdk/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) => {
...
});
MoveSdk.addLogListener((log: MoveSdkLog) => {
...
});License
MIT
