The Mobile Protect SDK has a dedicated integration for iOS and Android apps built using Flutter. This document will take you through the steps to integrate the SDK into your build system. For other guides, check out Mobile Protect Installation Guides
Preface
This will involve some steps on the Flutter side as well as some steps on both iOS and Android.
...
Step 4
In your main.dart
file
Import the Mobile Protect for Flutter library:
import 'package:flutter_mobile_protect/flutter_mobile_protect.dart';
Add the following initialiser method:
Code Block Future<void> initMobileProtect() async { try { await FlutterMobileProtect.init; } on PlatformException { print("Failed to initialize"); } }
Call
initMobileProtect()
when initialising your main App widget.
Android Integration
Step 1: Add the Mobile Protect Gradle Plugin
Declare dependencies within your project’s build.gradle
as follows:
...
Note: replace {VERSION}
with one of the provided versions in the SDK that matches the version of Gradle your project is using.
Step 2: Activate the Plugin
Activate the plugin in your App module's build.gradle
file, by adding the following statement after the apply plugin: 'com.android.application'
statement.
Code Block |
---|
apply plugin: 'com.dtplugin.mobileprotect' |
Step 3: Add the Mobile Protect configuration
In the Android project, create the xml
directory (flutter_app/android/app/src/main/res/xml
) if it does not exist. Then, copy the mobileprotect.xml
config file into the xml
resources folder.
...
In the iOS project copy the MobileProtect.plist
config file into the Flutter project's Xcode project, place it in the project root. See Add Existing Files and Folders to a Project for instructions.
Results
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.