Initialization

API Interface / Flutter

The MOVE SDK must be initialized natively. For the first init, the SDK expects to be setup after user onboarding using Flutter. In this case, Flutter passes the required MoveAuth and MoveConfig objects.

In all future inits, the SDK expects to be initialized natively at app start points (MainApplication for Android). This is to guarantee that the MOVE SDK is set up and active before the limited time provided by the OS in background wakeups is consumed.

The native init will re-use the last authentication and configs objects passed to the SDK from the Flutter initialization.

import 'package:movesdk/movesdk.dart';

Setup SDK

To setup the SDK with a registered user you have to provide MoveAuth, MoveConfig:

Future<void> setup(MoveAuth auth, MoveConfig moveConfig)

Android

To initialize the SDK natively, in your MainApplication:

import io.dolphin.move.MoveSdk
...
class MainApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        val sdk = MoveSdk.init(this)
        ...
        // you can use the native class furhter on
        // eg. sdk.allowMockLocations(true)
    }
}

For iOS the SDK is automatically initialized in the FlutterPlugin lifecycle during didFinishLaunchingWithOptions.

Notification

To use the MoveSdk in the background, it is required to configure the trip or als recognition notification, like shown in the following:

sdk.recognitionNotification(
    NotificationCompat.Builder(this, recognitionChannel)
        .setContentTitle("MOVE SDK")
        .setContentText("Trip detection")
        .setChannelId(recognitionChannel)
)

Make sure that you are also creating a notification channel. More information about notifications can be found at Notification Management.

Shutdown SDK

Shutdown SDK shared instance.

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

Precondition: SDK must be initialized.

Future<MoveShutdownResult> shutdown({bool force = true})

Configuration services

Update authentication

Updates SDK MoveAuth. The host app was expected to fetch a new MoveAuth using its project API key and pass it to the MoveSDK using the following API:

@Deprecated('obsolete')
Future<MoveAuthError?> updateAuth(MoveAuth auth)

Deprecated: Token expiry is no longer a valid auth state forwarded to the app and does not need to be handled.

Update configuration

Updates SDK MoveConfig.

Future<void> updateConfig(MoveConfig auth)

Last updated

Dolphin Technologies GmbH