MobbScan Cordova: Capacitor integration
Capacitor is supported by the MobbScan Cordova plugin, from v2.20.0. 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 will take several minutes because it downloads both the Android and iOS SDKs.
$ npm install @mobbeel/mobbscan-cordova-plugin@^2.20.0
- After that, you will have the MobbScan 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 MobbScan plugin installed in both of your native projects.
iOS considerations
As the MobbScan plugin uses the device camera, you need to give your app the proper permissions. You can find what permissions you need in this link.
If you need to use the videoconference feature, one more step is required. As Capacitor does not use hooks, you must add to your Xcode project the needed interface that the plugin provides. You will find the files in the Capacitor plugin folder, as you can see in the picture below:
Android considerations
For the Android platform, you just need to change the R file importation, as it's configured for the Cordova plugin path. Basically, you just need to find the file MobbScanVideoInterface.java and change this line:
import com.mobbeel.mobbscan.cordovaplugindemo.R;
for this:
import capacitor.android.plugins.R;