Flutter plugin installation
Prerequisites
Your existing Flutter application project has to meet the following prerequisites:
- iOS 12 or later
- Xcode 14.x, including Swift 5.7 or later
- Android 6 or later, with API level 23
- Android 10 or later, with API level 29, for the biometric authenticator to work
- Gradle 7.4 or later
- Android Gradle Plugin
com.android.tools.build:gradle
7.0.0 or later - Kotlin Gradle Plugin
org.jetbrains.kotlin:kotlin-gradle-plugin
1.6.0 or later - Flutter SDK 3.0.x, stable channel
Pub
Pub is the package manager for the Dart programming language, containing reusable libraries & packages for Flutter and general Dart programs.
Integration with Flutter
To integrate Nevis Mobile Authentication SDK Flutter plugin into your Flutter project with Flutter execute this command:
flutter pub add nevis_mobile_authentication_sdk
This will add a line like this to your package's pubspec.yaml
(and run an implicit flutter pub get
):
dependencies:
nevis_mobile_authentication_sdk: ^3.2.0
Manual integration
Alternatively, you can edit your pubspec.yaml
file manually:
dependencies:
flutter:
sdk: flutter
...
nevis_mobile_authentication_sdk: ^3.2.0
Then open a terminal and update the dependencies.
flutter pub get
Platform specific installation notes
Android
Gradle configuration
Add the following to your android/gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
android.enableDexingArtifactTransform=false
shrink=false
Repository configuration
The Nevis Mobile Authentication Client SDK for Android is published as a GitHub package. You have to specify the repository in your android/build.gradle
file:
allprojects {
repositories {
google ()
mavenCentral ()
maven {
url "https://maven.pkg.github.com/nevissecurity/nevis-mobile-authentication-sdk-android-package"
credentials {
username = <GITHUB_USERNAME>
password = <GITHUB_PERSONAL_ACCESS_TOKEN>
}
}
}
}
Accessing GitHub packages requires you to have a GitHub account. You have to provide a Personal Access Token, as described here.
Dependency configuration
Declare Nevis Mobile Authentication Client SDK as a dependency in your android/app/build.gradle
file:
dependencies {
//noinspection GradleDynamicVersion
debugImplementation 'ch.nevis:nevis-mobile-authentication-sdk-android-debug:3.2.+'
}
The package repository only exposes the debug
flavor. To use the release
flavor contact us on [email protected].
Backup Setup
The Android Mobile Authentication SDK does not support backing up and restoring its contents.
If your application does not require backing up any of its contents, disable the backup in the AndroidManifest.xml
of your application as described in the Android documentation:
<manifest ... >
...
<application android:allowBackup="false" ... >
...
</application>
</manifest>
If your application requires backing up contents, you must list them explicitly in AndroidManifest.xml
to avoid backing up the SDK contents.
If the contents of the Android Mobile Authentication SDK are backed up and then restored, the SDK can fail during initialization.
iOS
Dependency configuration
To integrate Nevis Mobile Authentication Client SDK into your Flutter application using CocoaPods, specify it in your Podfile:
pod 'NevisMobileAuthentication', :configurations => ['Release']
pod 'NevisMobileAuthentication-Debug', :configurations => ['Debug']
Bitcode support
As the native iOS SDK does not provide Bitcode support, the following post install step needs to be added to the Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO' # NMA SDK does not support Bitcode
end
end
end
Then execute pod install with update.
pod install --repo-update
Enable Face Recognition
Modify your applications Info.plist
file (located under ios/Runner) to add a description for the NSFaceIDUsageDescription
key to use the Face Recognition authenticator. Ideally, this value should be localized.
<key>NSFaceIDUsageDescription</key>
<string>Enabling Face ID allows you to use the Face Recognition authenticator.</string>