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
      • 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
  1. MOVE SDK
  2. API Interface
  3. React Native

Components

PreviousReact NativeNextInitialization

Last updated 2 months ago

LazyMoveSdk

Since MOVE SDK v2.7.0

import { LazyMoveSdk } from 'react-native-move-sdk';

Due to the fact that the application using MOVE SDK will be launched in the background in case of trip detection, all components and all functionality of the application will start working in normal mode, this consumes the memory of the device. The device's operating system may close applications that are running in the background to save memory, and if this happens to the application that is recording the trip, it will negatively affect the result of the trip recording.

The LazyMoveSdk wrapper component is designed to minimise the memory usage of the device. This component monitors and . LazyMoveSdk will remove it's children in one of the cases:

  • the app was started in the background

  • the app is in the background and MoveTripState is 'DRIVING', after some delay (delayToRemoveUiInBackgroundMs)

When AppState changes back to 'active', LazyMoveSdk will render it's children again, if they were removed.

Prop
Default
Description

delayToRemoveUiInBackgroundMs

30000

If the app was in the background and a trip is started - after this delay, the LazyMoveSdk children will be removed.

Please note, that LazyMoveSdk removes it's children. If you have some important logic (for example requests) inside of any child component, it will not be executed.

Usage example

import { lazy, useEffect } from 'react';
import { LazyMoveSdk } from 'react-native-move-sdk';

const App = lazy(() => import('./App')); // actual app

const LazyApp = () => (
  <LazyMoveSdk delayToRemoveUiInBackgroundMs={20000}>
    <App />
  </LazyMoveSdk>
);

export default LazyApp;

You can also wrap not the entire application code, but only the part that uses the most memory (like maps, charts, etc.).

AppState
MoveTripState