Dolphin MOVE SDK
2.x
2.x
  • Introduction
  • MOVE Services
  • MOVE SDK
    • Getting Started
      • MOVE Dashboard
        • Access Control
        • Configuration
        • Timeline
        • Points of Interest
      • Android
        • Installation
        • Quick Start
      • iOS
        • Installation
        • Quick Start
        • Troubleshooting
      • React Native
      • Flutter
      • Move SDK CLI
    • API Interface
      • Android
        • Initialization
        • Services
      • iOS
        • Initialization
        • Setup
        • Services
      • React Native
        • Components
        • Initialization
        • Services
      • Flutter
        • Initialization
        • Services
    • Models
      • Listeners/Callbacks
      • MoveAssistanceCallStatus
      • MoveAuth
      • MoveAuthError
      • MoveAuthResult
      • MoveAuthState
      • MoveConfig
      • MoveConfigurationError
      • MoveDevice
      • MoveDeviceStatus
      • MoveGeocodeError
      • MoveHealthItem
      • MoveHealthScore
      • MoveOptions
        • DeviceDiscovery
      • MoveSdkState
      • MoveSdkAndroidConfig
      • MoveTripState
      • MoveScanResult
      • MoveServiceFailure
      • MoveServiceWarning
      • MoveShutdownResult
    • Appendix
      • Token refresh
      • Android
        • Permission Handling
          • Permission Overview
          • Runtime Permissions
        • Battery optimization
        • Notification Management
        • Forcing the Signal - Classic Bluetooth
      • iOS
        • Permissions Handling
        • App Store
      • React Native
        • Permission Handling
  • MOVE Backend
    • MOVE Backend
      • MOVE Admin API
      • MOVE TIMELINE API
      • MOVE State API
      • MOVE Last Location API
    • MOVE Generic Notifier
    • MOVE Assistance Notifier
    • Example requests
  • FAQ
  • Changelog
    • Android
    • iOS
    • React
    • Flutter
    • Backend
  • Data privacy (GDPR)
Powered by GitBook
On this page
  • Detection Services
  • Start Automatic Detection
  • Stop Automatic Detection
  • Force Trip Recognition
  • Finish Current Trip
  • Ignore Current Trip
  • Set Trip Metadata
  • Manual Start Trip
  • Processing Services
  • Keep in foreground (Android only)
  • Keep active (Android only)
  • Get SDK State
  • Get Trip State
  • Get Auth State
  • Get Errors
  • Get Warnings
  • Set SDK State Listener
  • Set SDK Auth State Listener
  • Set Trip State Listener
  • Set Errors Listener
  • Set Warnings Listener
  • Set Log Listener
  • Shutdown SDK
  • Resolve Error
  • Synchronize User Data
  • Other Services
  • Initiate Assistance Call
  • Set Assistance MetaData
  • Set Timer (Android only)
  • Cancel Timer (Android only)
  • Live Location TAG
  • Configuration services
  • Update authentication
  • Update config
  • Device Discovery
  • Start Scanning Devices
  • Set MoveDevice Connection State Listener
  • Get Registered Devices
  • Register Devices
  • Unregister Devices
  • Discover Devices
  • Set Health Score Listener
  • Set Remote Config Change Listener
  1. MOVE SDK
  2. API Interface
  3. React Native

Services

API Interface / React Native

PreviousInitializationNextFlutter

Last updated 12 days ago

import MoveSdk from 'react-native-move-sdk';

Detection Services

Start Automatic Detection

Starts the required detection services stated in the passed on initialization. Starting the service will set the to .running.

MoveSdk.startAutomaticDetection(): Promise<boolean>

Promise will be resolved with false if the SDK is not in .ready state.

Stop Automatic Detection

Stops the automatic detection service, including all SDK services like driving detection, points of interest, walking and places. Stopping the service will set the back to .ready.

MoveSdk.stopAutomaticDetection(): Promise<boolean>

Promise will be resolved with false if the SDK is not in .running state.

Force Trip Recognition

Temporarily calibrates the SDK to the highest detection mode.

In order to optimize battery consumption, the SDK goes through different detection modes with different battery consumption levels, depending on the user's current behavior and activity. In general, the SDK is responsible for alternating between those different detection modes.

The SDK also provides hosting apps this API to call if they have their own reasons (like buttons, sensors or beacons) to believe that the user is starting a trip. This will make sure the SDK is on the highest detection state to detect the trip faster.

MoveSdk.forceTripRecognition(): void

Finish Current Trip

Ends the current ongoing trip.

MoveSdk.finishCurrentTrip(): void

If this API is called while the user is active on a driving trip, a new trip will start again right away. If the intention is to un-track the ongoing trip, call ignoreCurrentTripAPI.

Ignore Current Trip

Ignores the current ongoing trip.

MoveSdk.ignoreCurrentTrip(): void

Set Trip Metadata

Since MOVE SDK v2.8.0

Add key-value pairs to be appended to the trip metadata before the trip finishes.

Host apps can use this API to add any app-level information (for ex. Bluetooth beacon detected, foreground/background time, etc) to append to a trip as metadata (only for current trip, when the next trip starts old metadata is removed). This metadata will be forwarded back along with the trip when fetched by the client-server. Note: The SDK will not use this metadata element in any way, it is just passed through to the project environment.

MoveSdk.setTripMetadata(metadata?: { [key: string]: string }): void

Manual Start Trip

Since MOVE SDK v2.8.0

startTrip(metadata?: { [key: string]: string} ): Promise<boolean>

Promise will be resolved with false if the SDK is not in .ready state.

Processing Services

Keep in foreground (Android only)

When an Android application is in the background it may receive limited data (location, sensors, etc.). To improve this behaviour, it is possible to put the application always in the foreground with a visible notification that cannot be discarded. Just because it's visible it doesn't mean that it is performing any data collection at all. So this should not have any significant battery impact at all.

Disabled by default. Since it may be annoying to the user, it should only be enabled in case of problems.

MoveSdk.keepInForeground(enabled: boolean): void

Keep active (Android only)

Disabled by default. Since this is consuming more battery, it should only be enabled in case of problems.

MoveSdk.keepActive(enabled: boolean): void

Get SDK State

MoveSdk.getState(): Promise<SdkState>

Get Trip State

MoveSdk.getTripState(): Promise<TripState>

Get Auth State

MoveSdk.getAuthState(): Promise<AuthState>

Get Errors

MoveSdk.getErrors(): Promise<ErrorListType>

Get Warnings

MoveSdk.getWarnings(): Promise<WarningListType>

Set SDK State Listener

For android platform it is necessary to start listen explicitly by calling:

if (Platform.OS === 'android') {
    MoveSdk.startNativeSdkStateListener();
}
MoveSdk.addSdkStateListener(sdkStateChanged: (state: SdkState) => void): ListenerSubscription;

Callback

sdkStateChanged

Set SDK Auth State Listener

MoveSdk.addAuthStateListener(authStateChanged: (event: AuthStateEvent) => void): ListenerSubscription;

Callback

authStateChanged

Authentication Expiry

Set Trip State Listener

MoveSdk.addTripStateListener(tripStateChanged: (state: TripState) => void): ListenerSubscription;

Callback

tripStateChanged

Set Errors Listener

MoveSdk.addErrorsListener(errorsReceived: (errors: ErrorListType) => void): ListenerSubscription;

Set Warnings Listener

MoveSdk.addWarningsListener(warningsReceived: (warnings: ErrorListType) => void): ListenerSubscription;

Set Log Listener

Add a log listener for debugging.

static addLogListener(logReceived: (event: MoveSdkLog) => void): ListenerSubscription;

Shutdown SDK

Shutdown SDK shared instance.

Precondition: SDK must be initialized.

MoveSdk.shutdown(force:boolean = true): Promise<ShutdownReturnType>

Parameters

Default

force

true

When force: false is specified the shutdown may fail when pending data cannot be uploaded and reject the promise (status code: NETWORK_ERROR) which needs to be handled.

Resolve Error

MoveSdk.resolveError(): void

Synchronize User Data

Used to force synchronizing user data with the SDK server. Limited to once per 2 minutes.

MoveSdk.synchronizeUserData(): void

Other Services

Initiate Assistance Call

Initiate an assistance call to emergency services.

MoveSdk.initiateAssistanceCall(): Promise<boolean>

Precondition: The assistance call service needs to be configured in the MOVE dashboard. The SDK needs to be in ready or running state.

Set Assistance MetaData

Since MOVE SDK 2.1.0

MoveSdk.setAssistanceMetaData(data: string): void

Parameters

String

A string to be sent with each assistance call or impact

The metadata string is set once, and then sent to the server with each and every manual assistance call and with AID report. The contents of the string can be anything, e.g. JSON data. The assistance data is persisted once set.

Set Timer (Android only)

Since MOVE SDK v2.7.0

MoveSdk.setTimer(callback: () => void, delay?: number): string

Parameters

Default

delay

60000

number

Delay in miliseconds.

callback

function

Callback that will be executed after delay.

Cancel Timer (Android only)

Since MOVE SDK 2.7.0

MoveSdk.cancelTimer(key: string): void

Parameters

key

string

"Timer identifier" which was returned from setTimer.

Live Location TAG

Since MOVE SDK 2.8.0

MoveSdk.setLiveLocationTag(tag?: string): Promise<boolean>

Adds a Tag to trip events. This Tag information is added to the timeline data. To clear the Tag do not pass parameter.

Parameters

tag

String [a-z] [0-9] and null to clear the Tag.

Return values

true

Live Location Tag is applied.

true

Live Location Tag is cleared (no parameter is passed).

false

Live Location Tag exceeds the limit of 200 characters.

false

Live Location Tag is blank or empty.

false

If the passed chars are not one of these [a-z] [0-9].

Configuration services

Update authentication

MoveSdk.updateAuth(auth: MoveSdkAuth): Promise<void>
Parameters

auth

The user's updated Auth object with the new token.

Update config

Since MOVE SDK v2.8.0

MoveSdk.updateConfig(config: MoveSdkConfig, options?: MoveSdkOptions): Promise<boolean>

Device Discovery

Start Scanning Devices

Start scanning for devices which can be registered on the SDK for trip device discovery. A block will get invoked each time new devices are found.

MoveSdk.startScanningDevices(sdkDevicesDetected: (state: Array<MoveSdkDevice>) => void, filter: MoveSdkDeviceFilter[], uuid?: string, manufacturerId?: number): ListenerSubscription;
Parameters

sdkDevicesDetected

Listener

filter

MoveSdkDeviceFilter

Filter devices by type. See bellow.

uuid

string

UUID String required to scan beacons.

manufacturerId

number

Manufacturer ID needed to scan beacons.

Returns a subscription object. Scanning will stop automatically when the subscription is removed, otherwise the scan will continue and this will impact device battery usage.

A list of filters can be specified to filter which devices to scan for:

MoveDeviceFilter

paired

Scan for paired devices. Default

connected

Scan for connected devices. New since version 2.10.4.

beacon

Scan for beacon devices. uuid and manufacturerId required.

Set MoveDevice Connection State Listener

Since MOVE SDK v2.10.0

MoveSdk.addDeviceStateListener(onScanResult: (results: Array<MoveSdkDevice>) => void): ListenerSubscription;

Parameters

Get Registered Devices

MoveSdk.getRegisteredDevices(): Promise<Array<MoveSdkDevice>>;

Register Devices

MoveSdk.registerDevices(devices: Array<MoveSdkDevice>): Promise<boolean>;

Unregister Devices

Unregister devices (MoveSdkDevice) to be discovered during trips.

MoveSdk.unregisterDevices(devices: Array<MoveSdkDevice>): Promise<boolean>;

Discover Devices

MoveSdk.addDeviceDiscoveryListener(onScanResult: (results: Array<MoveScanResult>) => void): ListenerSubscription;

Set Health Score Listener

MoveSdk.addHealthListener(scoreReceived: (health: MoveHealthScore) => void): ListenerSubscription

Parameters

Block that get's invoked when the health score changes.

Set Remote Config Change Listener

Since MOVE SDK v2.5

MoveSdk.addRemoteConfigChangeListener(configChangeReceived: (config: Array<IssueListService>) => void): ListenerSubscription

Parameters

listener

A callback returning a List of services after a successful server fetch.

This API will end the ongoing trip and set back to .idle. The SDK is responsible for detecting the trip start and end points. The SDK also provides hosting apps this API to call if they have their own reasons (like sensors or beacons) to believe that the user's trip has ended.

Precondition: should be in an active trip.

More information about trip states can be found in .

This API will set the ongoing to .ignored. Data of ignored trips is purged and not sent to the server.

Precondition: should be in an active trip.

Manually force the start of a trip, bypassing trip validation checks. This non-standard SDK usage may be feasible only in situations where active user input can be expected. Using the metadata parameter, self-defined information can be added to each trip which can be fetched from the .

Precondition: MOVE SDK must be inREADY.

Manually starting a trip bypasses additional trip detection checks. Manually started trips must be ended with

It is recommended not to use motionPermissionMandatory orbackgroundLocationPermissionMandatorywith this API, as they will be ignored.

To save battery consumption, the SDK is using several triggers to start its data listeners. In case of trouble, these triggers can be circumvented by allowing the MoveSdk to stay active all the time. In that case the SDK is always monitoring required data and is therefore consuming more battery. Depending on the configuration, it may happen that the notification (see) is always visible to the user.

Gets the current.

Get the current .

Get the current .

Get the current list of .

Get the current list of .

Provide a block to be invoked every time changes.

Set the listener before initializing the SDK to anticipate the SDK changes triggered by the initialization API. Here the host app can start the SDK services when is.readyor handle errors if occurred.

Block that gets invoked every time is changed and provides the updated .

Provide a block to be invoked every time changes.

Block that gets invoked every time is updated.

The host app is expected to monitor updates viaauthStateUpdateListene API and handle those changes accordingly.

Check for more details about authentication expiry and renewal.

Provide a block to be invoked every time changes.

Block that gets invoked every time is changed and provides the updated .

Provide a block to be invoked every time changes.

Provide a block to be invoked every time changes.

Stops SDK services, send the queued user data, and de-initializes the SDK. After that is executed, the will transit to .uninitialized.

If it's necessary just to stop all SDK services you most likely need to use instead of shutdown. Use shutdown in case of user's logout, SDK auth error (in those cases where you know for sure that you will need to execute with new object, for example).

If true, shutdown executes immediately. Pending Data may be lost and always returns with a success, see otherwise.

New feature in MOVE SDK 2.x; configuration in MOVE dashboard pending - please .

Returns a promise with a .

Usual setTimeout doesn't work if app is in the background on Android. The SDK provides setTimer that works in the same way as setTimeout, but also in the background. A call to setTimer returns a “timer identifier” that we can use to cancel the execution via .

This method removes timer that was added via .

After a shutdown(...) ( / ) the Tag is also cleared.

Updates SDK . On SDK auth expiry, the authStateListener will trigger expired state. The host app is expected to fetch a new using its project API key and pass it to the MoveSDK using the following API:

Change the originally passed in setup. Optionally update the passed in setup.

Due to limitations in Android’s Classic Bluetooth APIs, reliable connection status tracking may not always be possible. For more details and available workarounds, see .

Block that gets invoked every time a new is detected.

Set a connection state listener to be fired when the Bluetooth connection state of a previously registered has changed.

listener ->

A callback returning the which connection state was changed.

Get a list of devices () registered to be discovered during trips.

Register devices () to be discovered during trips.

Since MOVE SDK v2.13: Devices are persisted after .

Subscribe to updates for registered devices scanned during trips. See .

Provide a block to be invoked every time MoveHealthScorewill change.

Provide a block to be invoked every time was successfully fetched from the server.

data
MoveConfig
MoveSDKState
MoveSDKState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
timeline
MoveSdkState
finishCurrentTrip()
MoveOptions
notification handling
MoveSDKState
MoveTripState
MoveAuthState
MoveServiceFailure
MoveServiceFailure
MoveSDKState
MoveSDKState
State
MoveSDKState
MoveAuthState
MoveAuthState
Authentication updates and expiry
MoveTripState
MoveServiceFailure
MoveServiceWarning
MoveSDKState
stopAutomaticDetection
MoveSdk.setup
MoveAuth
get in touch
MoveAssistanceCallStatus
cancelTimer
setTimer
Android
iOS
MoveAuth
MoveAuth
MoveConfig
MoveOptions
Forcing the Signal - Classic Bluetooth
MoveDevice
MoveDevice
MoveSdkDevice
MoveSdkDevice
shutdown
MoveScanResult
MoveConfig
MoveSDKState
MoveSDKState
MoveAuthState
MoveTripState
MoveTripState
ShutdownReturnType
MoveSdkDevice
MoveDeviceStateListener
MoveDevice
MoveHealthScoreListener