MobbScan Cordova: Initialization
Initialization
First of all, the plugin will not be available until the Cordova deviceready
event triggers. It is strongly recommended to initialize MobbScan Cordova plugin as follows:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Here goes MobbScanAPI initialization code.
}
If you are using Ionic and Angular, Platform.ready()
method could be used:
import { Platform } from '@ionic/angular';
class SomeComponent {
constructor(private platform: Platform) {
this.platform.ready().then(() => {
// Here goes MobbScanAPI initialization code.
});
}
}
In both cases, the first steps that should be performed are the definition of MobbScan API URL and the initialization of the API using a provided license code:
MobbScanAPI.setBaseURL(inputBaseUrl.value, success, failure);
MobbScanAPI.initAPIWithLicense(inputLicenseId.value, success, failure);
In both methods, success
and failure
are callbacks that will be called in case of success or failure respectively.
Once the success
callback of MobbScanAPI.initAPIWithLicense
is called, MobbScanAPI
is ready.