The Mobile Protect SDK for Flutter supports the iOS and Android platforms. This document will take you through the steps to integrate the SDK into your project. For other guides, check out https://datatheorem.atlassian.net/plugins/servlet/servicedesk/customer/confluence/shim/spaces/PKB/pages/1800142885
In order for Mobile Protect Flutter to correctly fetch its dependencies a Mobile Protect API key is needed. If you haven’t received an API key for Mobile Protect, please contact us.
...
Code Block |
---|
dependencies: //... mobile_protect: ^23^24.0.0 |
Note: the latest version of the SDK can be seen here:
...
Please visit https://www.securetheorem.com/mobile/protect to see the list of your apps and the state of protection, along with the individual protection item details.
Setup callbacks
MobileProtect supports 2 types of callbacks: protections and events. Protection callbacks are triggered before closing the app and event callbacks are triggered on security events.
They can be setup using FlutterMobileProtect.onProtectionCallback((reason) async { TODO(); });
and FlutterMobileProtect.onEventsCallback((reason) async { TODO(); });
For example, if you want to listen to emulator and jailbreak protection events only, you can use it this way:
Code Block |
---|
FlutterMobileProtect.onEventsCallback((reason) async { if(reason == "EmulatorProtection") { // do something } else if (reason == "JailbreakDetection") { // do something (else) } else { // do nothing } }); |
...
Upgrading from earlier versions (prior to v23.0.0)
...
update the Flutter plugin version in the project’s
pubspec.yaml
file, or if installing from a local copy of the plugin, update that local copy to the new plugin. For example, we may change:Code Block dependencies: //... mobile_protect: ^22.3.14 # OLD VERSION!
to:
Code Block dependencies: //... mobile_protect: ^23^24.0.0
Remove references to the previous Android installation:
remove the old remove the reference to the old android plugin by removing this line from
android/app/build.gradle
:Code Block apply plugin: 'com.dtplugin.mobileprotect
remove any references to
mobileprotect
andaspectj
from the dependencies section ofandroid/build.gradle
Follow the steps outlined in the section Step 2: configure for Android above. Note that no changes are necessary for iOS configuration.
...