Initialization
API Interface / Flutter
Last updated
API Interface / Flutter
Last updated
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 auth code or 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.
To setup the MOVE SDK with a registered user you have to provide MoveAuth, MoveConfig:
Will be remove in future versions, use setupWithCode(...)
instead.
Alternative to the approach with the MoveAuth you can setup the MOVE SDK with an authentication string. This authCode must be fetched from the backend using the userId (see MOVE Backend - Example request).
To initialize the SDK natively, in your MainApplication:
For iOS the SDK is automatically initialized in the FlutterPlugin
lifecycle during didFinishLaunchingWithOptions.
To use the MoveSdk in the background, it is required to configure the trip or als recognition notification, like shown in the following:
Make sure that you are also creating a notification channel. More information about notifications can be found at Notification Management.
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.
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: Token expiry is no longer a valid auth state forwarded to the app and does not need to be handled.
Updates SDK MoveConfig.
Parameters | |
---|---|
Parameters
auth
MoveAuth object to authenticate the user. See Move Backend section for acquiring credentials.
moveConfig
MoveConfig object to setup services.
options
Optional MoveOptions object
Parameters
authCode
authCode string to authenticate the user. See Move Backend section for acquiring credentials.
moveConfig
MoveConfig object to setup services.
options
Optional MoveOptions object
Returns
Parameters
Default
force
true
If true, shutdown
executes immediately. Pending Data may be lost.
Returns
config
The new MoveConfig to use.
Throws
uninitialized
The SDK is in uninitialized
state.