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 AppState and MoveTripState. 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.

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 />

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.).

Last updated

Dolphin Technologies GmbH