Opt-In/Opt-Out setting
Opt-In / Opt-Out settings :
The host application can provide an option to the users to Opt-In and Opt-Out of the Ads services. The same can be accomplished via the following methods to access or update the Status.
Update Opt-In Status
// imports and declaration
import { Platform } from '@ionic/angular';
declare var cordova : any;
// to update opt value from host app from toggle button or any UI component
cordova.plugins.amlibrary.updateOptInStatus(true);  // or falseThe method accepts boolean value. When true is passed, the user is Opted-In to the Ad services and when false is passed, the user is Opted-Out of the Ad Service.
Get Opt-In status
// imports and declaration
import { Platform } from '@ionic/angular';
declare var cordova : any;
public status : boolean;
// Below code need to write inside ngOnInit()
var success = function(result) {
console.log("Home Page " + result)
    if(result == 1) {
      this.status = true; // need to use this value for UI update or as per requirement
    } else if(result == 0) {
      this.status = false; // need to use this value for UI update or as per requirement
    }
}
var failure = function(result) {
}
this.platform.ready().then(() => {
  if(cordova != null && cordova.plugins != null && cordova.plugins.amlibrary != null) {
    cordova.plugins.amlibrary.getOptInStatus("ABCD", success, failure);
  }
});The method returns boolean value. If true is returned, the user has Opted-In to the Ad Services and when false the user is Opted-Out of the Ad Services.
Updated 5 months ago
