MobbID Cordova: Capacitor integration
Capacitor is supported by the MobbID Cordova plugin, since first version. In order to add it to your integration, you must follow these steps:
- Add the following line in your
.npmrc
file in the root of your project (if it does not exist, just create it empty):
//registry.npmjs.org/:_authToken=the-provided-token
- Run the following command in the root of your Cordova project:
WARNING: This step may take several minutes, because it downloads the Android SDK.
npx cordova plugin add @mobbeel/mobbid-cordova-plugin
- After that, you will have the MobbID Cordova plugin installed on your webapp. Now you just have to synchronize Capacitor:
npx cap sync
Alternatively, you can create the Android/iOS native projects at this point, if you haven't yet:
npx cap add android
npx cap add ios
After this, you will have the MobbID plugin installed in all platforms.
Android considerations
INFO: Plugin version 2.1.0 or higher not require any additional configuration. If you are using a previous version, please follow the next steps.
For the Android platform, Capacitor uses *.jar
files instead of *.aar
files. You just need to change the extension of the SDK imported libs in the build.gradle
file. This file is located in the android/capacitor-cordova-android-plugins/
directory.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar']) // Change this line
}
Once you have changed this line, you must to build the project again. Ensure that all the dependencies are correctly imported like in the next image (libs version can vary):
iOS considerations
For the iOS platform, next permissions must be added to the Info.plist
file:
<key>NSCameraUsageDescription</key>
<string>Camera access is required for confirm user identity</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required for confirm user identity</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access is required for confirm user identity</string>