MOTIONTAG SDK Flutter Plugin
The MOTIONTAG Mobility & Location Analytics SDK enables to collect raw sensor data of the telephone in a battery efficient way. This data is then transmitted to the MOTIONTAG back-end system (ISO 27001 certified). In the backend, the sensor events are processed and a partial journey is constructed. Journeys consist either solely of tracks or tracks plus stays. Tracks describe a movement from a origin to a destination with a certain mode of transport. Stays symbolize a stationary behaviour with a particular purpose for the visit.
The use cases for the SDK are manifold. In the mobility sector it can be used to get detailed mobility data for planning purposes. The collected data enables to compare how the transport network is being used. This way the effectiveness of the current infrastructure and the passenger flow management is measured and the design of new mobility services. By implementing and using the SDK you can make use of these findings to improve timetables and routes, expand transport supply and attract more passengers.
If you integrate the MOTIONTAG SDK inside your own application, you can either download user journeys via a provided dump interface on the internet or we tailor a customized solution to your needs.
The general principle was to expose the intersection of the features of the two implementation, meaning that some Android-only and iOS-only features are intentionally left out. Minimum supported OS versions:
|API 23+||iOS 12.3+|
motiontag_sdk as a dependency in your pubspec.yaml file.
The SDK must be initialized before the plugin registration in the
didFinishLaunchingWithOptions application's delegate function.
handleEventsForBackgroundURLSession calls must be forwarded by overriding the appropriate delegate.
Check out AppDelegate.swift as an example.
Application, which you register in the
You have to call
MotionTagWrapper.initialize() from the
onCreate callback and provide the required arguments.
MainApplication.kt as an example.
Auto Backup for Apps is a platform feature that automatically backs up a user's data from apps that target and run on Android 6.0 (API level 23) or later. To limit unexpected behavior from our SDK, you should either disable automated backups entirely or exclude the appropriate SDK files from full backup. Please check this section of the native Android MOTIONTAG SDK for more information.
2. Permission management
Since the permission management is not part of the MOTIONTAG SDK, it is the app's responsibility to acquire the permissions/authorizations from the user before starting the SDK.
The SDK requires access to location updates in the background, for that please add following capability in Xcode:
- Capabilities -> Background Modes:
- Location Updates
Additionally, The SDK requires two authorizations before being started:
Location (Always) and
Therefore, add the following items to your app's
- "Privacy - Motion Usage Description" string
- "Privacy - Location Always & When in Use Description" string
- "Privacy - When in Use Description" string
If you use
permission_handler make sure to add the
requested snippets to the Podfile for each of them.
The following runtime permissions are required before starting the SDK:
Some of these permissions may not be required when targeting older Android versions. Please check the native Android MOTIONTAG SDK documentation for more info.
The MotionTag class is the main entry point of the SDK. It has the following public functions:
||Starts tracking. It's not necessary to call this method again after a device reboot.|
||Sets the user token (JWT). The SDK expects a valid user token prior to executing the
||Retrieved the persisted user token or
||Set a function to be called by the SDK to inform abour relevant changes (e.g.: data transmission error, tracking started, etc).|
||Deletes all unstransmitted stored user data from the SDK. This function is useful when signing out the user from your app.|
The MotionTagEvent class is the base class for all notifiable SDK events.
The SDK currently supports the following concrete implementations of the
||Informs the application that tracking has been started.|
||Informs the application that tracking has been stopped.|
||Hands the latest captured device location to the application.|
||Informs when a package of events has been successfully sent to the server.|
||Informs when a package of events failed to be transmitted to the server.|
4. User authentication
5. Non-standard background process limitations on Android
Some Android OEMs, like Huawei and OnePlus, decided to implement non-standard background process limitations on 3rd party apps as an attempt to reduce battery consumption. The MOTIONTAG SDK must be running all times in the background, otherwise it won't function properly.
Therefore we recommend developers integrating our SDK to read the https://dontkillmyapp.com website, it describes this problem in detail and it provides some workaround options for both developers and users. There's also this StackOverflow post which describes how developers can forward users to the correct OEM settings.
When battery optimization is turned on for your app, the MOTIONTAG SDK may not be able to track and generate data continuously. If 24/7 tracking on all supported phone models is crucial to your use case, we strongly recommend you to include a prompt for the user, and facilitate the deactivation of battery optimization settings for your app on the affected phones.
The SDK is licensed under the MOTIONTAG SDK Test License.