Dolphin MOVE SDK
SDK
1.x
1.x
  • Introduction
  • MOVE Services
  • MOVE SDK
    • Getting Started
      • MOVE Dashboard
      • Android
        • Installation
        • Quick Start
      • iOS
        • Installation
        • Quick Start
      • React Native
    • API Interface
      • Android
        • Initialization
        • Services
      • iOS
        • Initialization
        • Services
      • React Native
        • Initialization
        • Services
    • Models
      • MoveAuth
      • MoveConfig
      • MoveConfigurationError
      • MoveDeviceStatus
      • MoveSDKState
      • MoveTripState
      • MoveAuthState
      • Listeners/Callbacks
    • Appendix
      • Android
        • Token refresh
        • Permission Handling
        • Battery optimization
        • Notification Management
      • iOS
        • Permissions Handling
        • App Store
  • MOVE Backend
    • MOVE Timeline
    • MOVE State
    • MOVE Last Location
    • MOVE Generic Notifier
    • Open Api Specification
  • Changelog
    • Android
    • iOS
  • 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
  • Processing Services
  • Keep in foreground (Android only)
  • Keep active (Android only)
  • Get SDK State
  • Set SDK State Listener
  • Get SDK Auth State
  • Set SDK Auth State Listener
  • Get Trip State
  • Set Trip State Listener
  • Shutdown SDK
  • Synchronize User Data
  • Configuration services
  • Update authentication
  1. MOVE SDK
  2. API Interface
  3. React Native

Services

React Native

PreviousInitializationNextModels

Last updated 2 years 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.

Precondition: SDK should be in.ready

startAutomaticDetection: () => void

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.

Precondition: SDK should be in.running.

stopAutomaticDetection: () => void

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.

Precondition: SDK should be in.running .

forceTripRecognition: () => void

Finish Current Trip

Ends the current ongoing trip.

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.

ignoreCurrentTrip: () => void

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 behavior, 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.

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.

keepActive: (enabled: boolean) => void

Get SDK State

getState: () => Promise<SdkState>

Return

Latest SDK State

Set SDK State Listener

addSDKStateListener: (
    sdkStateChanged: (event: SdkStateEvent) => void
) => ListenerSubscription

Callback

sdkStateChanged

Get SDK Auth State

Return

Latest SDK State

Set SDK Auth State Listener

addAuthStateListener: (
    authStateChanged: (event: AuthStateEvent) => void
) => ListenerSubscription

Callback

authStateChanged

Authentication Expiry

Get Trip State

getTripState: () => Promise<TripState>

Return

Set Trip State Listener

addTripStateListener: (
    tripStateChanged: (state: TripState) => void
) => ListenerSubscription

Callback

tripStateChanged

Shutdown SDK

Shutdown SDK shared instance.

Precondition: SDK should be initialized.

shutdown: () => void

Synchronize User Data

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

synchronizeUserData: () => void

Configuration services

Update authentication

updateAuth: (auth: MoveSdkAuth) => Promise<void>
Parameters

auth

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

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.

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.

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 .

Gets the current .

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.

Gets the current .

Current

Provide a block to be invoked every time changes.

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

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

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

MoveConfig
MoveSDKState
MoveSDKState
MoveSDKState
MoveSDKState
MoveSDKState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
notification handling
MoveSDKState
MoveSDKState
MoveSDKState
State
MoveSDKState
MoveAuthState
MoveAuthState
MoveAuthState
MoveTripState
MoveTripState
MoveSDKState
MoveAuth
MoveAuth
MoveSDKState
MoveSDKState
MoveSDKState
MoveAuthState
MoveAuthState
MoveTripState
MoveTripState
MoveTripState
MoveTripState
Authentication updates and expiry