emi-indo-cordova-plugin-admob 1.4.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -159
- package/example/Advanced topics/{consent_GDPR_IAB_TFCv2.2.html → IABTFC.html } +22 -114
- package/example/Advanced topics/consent.html +47 -35
- package/example/Advanced topics/globalSettings.html +17 -8
- package/example/Advanced topics/requestIDFA.html +59 -0
- package/example/Advanced topics/targeting.html +14 -28
- package/example/app_open_ads.html +20 -43
- package/example/banner_ads.html +60 -109
- package/example/interstitial_ads.html +28 -44
- package/example/rewarded_ads.html +29 -45
- package/example/rewarded_interstitial_ads.html +27 -44
- package/package.json +1 -2
- package/plugin.xml +3 -3
- package/src/android/emiAdmobPlugin.java +1 -1
- package/src/ios/emiAdmobPlugin.h +4 -2
- package/src/ios/emiAdmobPlugin.m +451 -482
- package/www/emiAdmobPlugin.js +21 -27
- package/example/Advanced topics/auto_load_and_show.html +0 -94
@@ -12,50 +12,30 @@
|
|
12
12
|
let event = document.getElementById('event');
|
13
13
|
|
14
14
|
let cleanText = () => { event.value = '' };
|
15
|
-
|
16
|
-
let debug = false;
|
17
15
|
|
18
16
|
|
17
|
+
// WARNING config must be an array[] not an object{}
|
18
|
+
const config_Interstitial = [
|
19
|
+
|
20
|
+
adUnitId = "ca-app-pub-3940256099942544/1033173712",
|
21
|
+
autoShow = true
|
22
|
+
|
23
|
+
]
|
24
|
+
|
19
25
|
|
20
|
-
// Load Interstitial Ad
|
21
26
|
|
27
|
+
// Load Interstitial Ad
|
22
28
|
let loadInterstitialAd = () => {
|
23
|
-
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
(info) => {
|
29
|
-
|
30
|
-
if (debug === true) {
|
31
|
-
|
32
|
-
event.value += "\n ResponseInfo: " + info; // responseInfo = true
|
33
|
-
|
34
|
-
} else
|
35
|
-
if (debug === false) {
|
36
|
-
|
37
|
-
// responseInfo = false
|
38
|
-
// event name: on.interstitial.revenue
|
39
|
-
|
40
|
-
event.value += "\n Micros: " + info.micros;
|
41
|
-
event.value += "\n Currency: " + info.currency;
|
42
|
-
event.value += "\n Precision: " + info.precision;
|
43
|
-
event.value += "\n AdUnitId: " + info.adUnitId;
|
44
|
-
|
45
|
-
}
|
46
|
-
|
47
|
-
},
|
48
|
-
(error) => {
|
49
|
-
|
50
|
-
event.value += "\n Error: " + error
|
51
|
-
|
52
|
-
});
|
29
|
+
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(config_Interstitial);
|
30
|
+
// Or like this
|
31
|
+
// cordova.plugins.emiAdmobPlugin.loadInterstitialAd([adUnitId = "ca-app-pub-3940256099942544/1033173712", autoShow = false ]);
|
32
|
+
// call loadInterstitialAd();
|
53
33
|
}
|
54
34
|
|
55
35
|
// Show Interstitial Ad
|
56
|
-
|
57
36
|
let showInterstitialAd = () => {
|
58
37
|
cordova.plugins.emiAdmobPlugin.showInterstitialAd();
|
38
|
+
// call showInterstitialAd();
|
59
39
|
}
|
60
40
|
|
61
41
|
|
@@ -63,20 +43,24 @@ let showInterstitialAd = () => {
|
|
63
43
|
|
64
44
|
|
65
45
|
document.addEventListener("deviceready", function(){
|
46
|
+
// WARNING config must be an array[] not an object{}
|
47
|
+
const config_globalSettings = [
|
48
|
+
|
49
|
+
// DEPRECATED enableSameAppKey
|
50
|
+
setAppMuted = false, // Type Boolean default: false
|
51
|
+
setAppVolume = 1.0, // Type float default: 1
|
52
|
+
publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
|
53
|
+
npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
|
54
|
+
enableCollapsible = true, // (BETA) activate the collapsible banner ads
|
55
|
+
responseInfo = false, // For debugging and logging purposes
|
66
56
|
|
67
|
-
|
68
|
-
// This needs to be done only once, ideally at app launch.
|
57
|
+
]
|
69
58
|
|
70
|
-
|
71
|
-
// Optional
|
72
|
-
(info) => {
|
73
|
-
event.value += (info)
|
74
|
-
},
|
75
|
-
(error) => {
|
59
|
+
cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
|
76
60
|
|
77
|
-
event.value += (error)
|
78
61
|
|
79
|
-
|
62
|
+
// Must be under globalSetting and targeting
|
63
|
+
cordova.plugins.emiAdmobPlugin.initialize();
|
80
64
|
|
81
65
|
// SDK EVENT Initialization
|
82
66
|
|
@@ -13,52 +13,31 @@
|
|
13
13
|
|
14
14
|
let cleanText = () => { event.value = '' };
|
15
15
|
|
16
|
-
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
// WARNING config must be an array[] not an object{}
|
20
|
+
const config_rewarded = [
|
17
21
|
|
22
|
+
adUnitId = "ca-app-pub-3940256099942544/5224354917",
|
23
|
+
autoShow = true
|
18
24
|
|
25
|
+
]
|
19
26
|
|
20
|
-
// Load Rewarded Ad
|
21
27
|
|
22
28
|
|
29
|
+
// Load Rewarded Ad
|
23
30
|
let loadRewardedAd = () => {
|
24
|
-
cordova.plugins.emiAdmobPlugin.loadRewardedAd(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
(info) => {
|
31
|
-
|
32
|
-
if (debug === true) {
|
33
|
-
|
34
|
-
event.value += "\n ResponseInfo: " + info; // responseInfo = true
|
35
|
-
|
36
|
-
} else
|
37
|
-
if (debug === false) {
|
38
|
-
|
39
|
-
// responseInfo = false
|
40
|
-
// event name: on.rewardedInt.revenue
|
41
|
-
|
42
|
-
event.value += "\n Micros: " + info.micros;
|
43
|
-
event.value += "\n Currency: " + info.currency;
|
44
|
-
event.value += "\n Precision: " + info.precision;
|
45
|
-
event.value += "\n AdUnitId: " + info.adUnitId;
|
46
|
-
|
47
|
-
}
|
48
|
-
|
49
|
-
},
|
50
|
-
(error) => {
|
51
|
-
|
52
|
-
event.value += "\n Error: " + error
|
53
|
-
|
54
|
-
});
|
31
|
+
cordova.plugins.emiAdmobPlugin.loadRewardedAd(config_rewarded);
|
32
|
+
// Or like this
|
33
|
+
// cordova.plugins.emiAdmobPlugin.loadRewardedAd([adUnitId = "ca-app-pub-3940256099942544/5224354917", autoShow = false ]);
|
34
|
+
// call loadRewardedAd();
|
55
35
|
}
|
56
36
|
|
57
37
|
// Show Rewarded Ad
|
58
|
-
|
59
38
|
let showRewardedAd = () => {
|
60
39
|
cordova.plugins.emiAdmobPlugin.showRewardedAd();
|
61
|
-
|
40
|
+
// call showRewardedAd();
|
62
41
|
}
|
63
42
|
|
64
43
|
|
@@ -67,19 +46,24 @@ let showRewardedAd = () => {
|
|
67
46
|
|
68
47
|
document.addEventListener("deviceready", function(){
|
69
48
|
|
70
|
-
//
|
71
|
-
|
49
|
+
// WARNING config must be an array[] not an object{}
|
50
|
+
const config_globalSettings = [
|
51
|
+
|
52
|
+
// DEPRECATED enableSameAppKey
|
53
|
+
setAppMuted = false, // Type Boolean default: false
|
54
|
+
setAppVolume = 1.0, // Type float default: 1
|
55
|
+
publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
|
56
|
+
npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
|
57
|
+
enableCollapsible = true, // (BETA) activate the collapsible banner ads
|
58
|
+
responseInfo = false, // For debugging and logging purposes
|
59
|
+
|
60
|
+
]
|
72
61
|
|
73
|
-
|
74
|
-
// Optional
|
75
|
-
(info) => {
|
76
|
-
event.value += (info)
|
77
|
-
},
|
78
|
-
(error) => {
|
62
|
+
cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
|
79
63
|
|
80
|
-
event.value += (error)
|
81
64
|
|
82
|
-
|
65
|
+
// Must be under globalSetting and targeting
|
66
|
+
cordova.plugins.emiAdmobPlugin.initialize();
|
83
67
|
|
84
68
|
// SDK EVENT Initialization
|
85
69
|
|
@@ -13,51 +13,29 @@
|
|
13
13
|
|
14
14
|
let cleanText = () => { event.value = '' };
|
15
15
|
|
16
|
-
|
16
|
+
// WARNING config must be an array[] not an object{}
|
17
|
+
const config_rewardedInt = [
|
17
18
|
|
19
|
+
adUnitId = "ca-app-pub-3940256099942544/5354046379",
|
20
|
+
autoShow = true
|
18
21
|
|
22
|
+
]
|
19
23
|
|
20
|
-
// load Rewarded Interstitial Ad
|
21
24
|
|
22
|
-
let loadRewardedInterstitialAd = () => {
|
23
|
-
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(
|
24
|
-
AdUnitId = "ca-app-pub-3940256099942544/5354046379",
|
25
|
-
npa = "1", // String | 0 | 1
|
26
|
-
responseInfo = debug, // boolean
|
27
|
-
|
28
|
-
(info) => {
|
29
|
-
|
30
|
-
if (debug === true) {
|
31
|
-
|
32
|
-
event.value += "\n ResponseInfo: " + info; // responseInfo = true
|
33
|
-
|
34
|
-
} else
|
35
|
-
if (debug === false) {
|
36
|
-
|
37
|
-
// responseInfo = false
|
38
|
-
// event name: on.rewardedInt.revenue
|
39
|
-
|
40
|
-
event.value += "\n Micros: " + info.micros;
|
41
|
-
event.value += "\n Currency: " + info.currency;
|
42
|
-
event.value += "\n Precision: " + info.precision;
|
43
|
-
event.value += "\n AdUnitId: " + info.adUnitId;
|
44
|
-
|
45
|
-
}
|
46
|
-
|
47
|
-
},
|
48
|
-
(error) => {
|
49
|
-
|
50
|
-
event.value += "\n Error: " + error
|
51
|
-
|
52
|
-
});
|
53
25
|
|
26
|
+
// load Rewarded Interstitial Ad
|
27
|
+
let loadRewardedInterstitialAd = () => {
|
28
|
+
cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd(config_rewardedInt);
|
29
|
+
// Or like this
|
30
|
+
// cordova.plugins.emiAdmobPlugin.loadRewardedInterstitialAd([adUnitId = "ca-app-pub-3940256099942544/5354046379", autoShow = false ]);
|
31
|
+
// call loadRewardedInterstitialAd();
|
54
32
|
}
|
55
33
|
|
56
34
|
|
57
35
|
// Show Rewarded Interstitial Ad
|
58
|
-
|
59
36
|
const showRewardedInterstitialAd = () => {
|
60
37
|
cordova.plugins.emiAdmobPlugin.showRewardedInterstitialAd();
|
38
|
+
// call showRewardedInterstitialAd();
|
61
39
|
}
|
62
40
|
|
63
41
|
|
@@ -66,19 +44,24 @@ const showRewardedInterstitialAd = () => {
|
|
66
44
|
|
67
45
|
document.addEventListener("deviceready", function(){
|
68
46
|
|
69
|
-
//
|
70
|
-
|
47
|
+
// WARNING config must be an array[] not an object{}
|
48
|
+
const config_globalSettings = [
|
49
|
+
|
50
|
+
// DEPRECATED enableSameAppKey
|
51
|
+
setAppMuted = false, // Type Boolean default: false
|
52
|
+
setAppVolume = 1.0, // Type float default: 1
|
53
|
+
publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
|
54
|
+
npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
|
55
|
+
enableCollapsible = true, // (BETA) activate the collapsible banner ads
|
56
|
+
responseInfo = false, // For debugging and logging purposes
|
57
|
+
|
58
|
+
]
|
71
59
|
|
72
|
-
|
73
|
-
// Optional
|
74
|
-
(info) => {
|
75
|
-
event.value += (info)
|
76
|
-
},
|
77
|
-
(error) => {
|
60
|
+
cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
|
78
61
|
|
79
|
-
event.value += (error)
|
80
62
|
|
81
|
-
|
63
|
+
// Must be under globalSetting and targeting
|
64
|
+
cordova.plugins.emiAdmobPlugin.initialize();
|
82
65
|
|
83
66
|
// SDK EVENT Initialization
|
84
67
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "emi-indo-cordova-plugin-admob",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.3",
|
4
4
|
"description": "Cordova Plugin Admob Android IOS",
|
5
5
|
"cordova": {
|
6
6
|
"id": "emi-indo-cordova-plugin-admob",
|
@@ -20,7 +20,6 @@
|
|
20
20
|
"cordova-admob-pro",
|
21
21
|
"cordova-admob-ios",
|
22
22
|
"cordova-admob-android"
|
23
|
-
|
24
23
|
],
|
25
24
|
"author": "EMI INDO",
|
26
25
|
"email": "cordova.c3addon@gmail.com",
|
package/plugin.xml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
2
2
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
-
id="emi-indo-cordova-plugin-admob" version="1.4.
|
3
|
+
id="emi-indo-cordova-plugin-admob" version="1.4.3">
|
4
4
|
|
5
5
|
<name>emiAdmobPlugin</name>
|
6
6
|
<description>Cordova Plugin Admob Android IOS</description>
|
@@ -44,7 +44,7 @@
|
|
44
44
|
<!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
|
45
45
|
|
46
46
|
<preference name="APP_ID_ANDROID" default="ca-app-pub-3940256099942544~3347511713" />
|
47
|
-
<preference name="PLAY_SERVICES_VERSION" default="22.
|
47
|
+
<preference name="PLAY_SERVICES_VERSION" default="22.6.0" />
|
48
48
|
|
49
49
|
<framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />
|
50
50
|
|
@@ -299,7 +299,7 @@
|
|
299
299
|
<source url="https://cdn.cocoapods.org/" />
|
300
300
|
</config>
|
301
301
|
<pods use-frameworks="true">
|
302
|
-
<pod name="Google-Mobile-Ads-SDK" spec="~> 10.
|
302
|
+
<pod name="Google-Mobile-Ads-SDK" spec="~> 10.14.0" />
|
303
303
|
</pods>
|
304
304
|
</podspec>
|
305
305
|
|
@@ -1 +1 @@
|
|
1
|
-
package emi.indo.cordova.plugin.admob;import android.app.Activity;import android.content.Context;import android.content.SharedPreferences;import android.content.res.Configuration;import android.os.Bundle;import android.util.Log;import android.view.View;import android.view.ViewGroup;import android.widget.RelativeLayout;import androidx.annotation.NonNull;import androidx.preference.PreferenceManager;import com.google.ads.mediation.admob.AdMobAdapter;import com.google.android.gms.ads.AdError;import com.google.android.gms.ads.AdListener;import com.google.android.gms.ads.AdRequest;import com.google.android.gms.ads.AdSize;import com.google.android.gms.ads.AdValue;import com.google.android.gms.ads.AdView;import com.google.android.gms.ads.FullScreenContentCallback;import com.google.android.gms.ads.LoadAdError;import com.google.android.gms.ads.MobileAds;import com.google.android.gms.ads.OnPaidEventListener;import com.google.android.gms.ads.RequestConfiguration;import com.google.android.gms.ads.ResponseInfo;import com.google.android.gms.ads.appopen.AppOpenAd;import com.google.android.gms.ads.initialization.AdapterStatus;import com.google.android.gms.ads.interstitial.InterstitialAd;import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;import com.google.android.gms.ads.rewarded.RewardedAd;import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback;import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAd;import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAdLoadCallback;import com.google.android.ump.ConsentForm;import com.google.android.ump.ConsentInformation;import com.google.android.ump.ConsentRequestParameters;import com.google.android.ump.UserMessagingPlatform;import org.apache.cordova.CallbackContext;import org.apache.cordova.CordovaInterface;import org.apache.cordova.CordovaPlugin;import org.apache.cordova.CordovaWebView;import org.json.JSONArray;import org.json.JSONException;import org.json.JSONObject;import java.util.Map;import java.util.Objects;public class emiAdmobPlugin extends CordovaPlugin{private static final String TAG="emiAdmobPlugin";private CallbackContext PUBLIC_CALLBACKS=null;private InterstitialAd mInterstitialAd;private RewardedAd rewardedAd;private RewardedInterstitialAd rewardedInterstitialAd;private CordovaWebView cWebView;private boolean isAppOpenAdShow=false;static boolean isinterstitialload=false;static boolean isrewardedInterstitialload=false;static boolean isrewardedload=false;int isBannerPause=0;String Npa;String Position;String Size;int AdaptiveWidth=320;Boolean ResponseInfo=false;int bannerAdImpression=0;private int isAdSkip=0;int SetTagForChildDirectedTreatment=-1;int SetTagForUnderAgeOfConsent=-1;String SetMaxAdContentRating="G";String appOpenAdUnitId;String bannerAdUnitId;String interstitialAdUnitId;String rewardedInterstitialAdUnitId;String rewardedAdUnitId;boolean SetAppMuted=false;float SetAppVolume=1;boolean EnableSameAppKey=false;private ConsentInformation consentInformation;private RelativeLayout bannerViewLayout;private AdView bannerView;private boolean isBannerLoad=false;private boolean isBannerShow=false;Boolean bannerAutoShow=false;Boolean appOpenAutoShow=false;Boolean intAutoShow=false;Boolean rewardedAutoShow=false;Boolean rIntAutoShow=false;String Collapsible;Boolean isCollapsible=false;Boolean lock=true;protected Activity mActivity;protected Context mContext;private AppOpenAd appOpenAd;int orientation=0;public void initialize(CordovaInterface cordova,CordovaWebView webView){super.initialize(cordova,webView);cWebView=webView;mActivity=this.cordova.getActivity();mContext=mActivity.getApplicationContext();int orientation=mActivity.getResources().getConfiguration().orientation;if(orientation==Configuration.ORIENTATION_PORTRAIT){this.orientation=0;}else{this.orientation=1;}}public boolean execute(String action,JSONArray args,final CallbackContext callbackContext)throws JSONException{PUBLIC_CALLBACKS=callbackContext;switch(action){case "initialize":Log.d(TAG,"Google Mobile Ads SDK: "+MobileAds.getVersion());MobileAds.initialize(mContext,initializationStatus ->{Map<String,AdapterStatus> statusMap=initializationStatus.getAdapterStatusMap();for(String adapterClass:statusMap.keySet()){AdapterStatus status=statusMap.get(adapterClass);if(status!=null){Log.d(TAG,String.format("Adapter name:%s,Description:%s,Latency:%d",adapterClass,status.getDescription(),status.getLatency()));}else{callbackContext.error(MobileAds.ERROR_DOMAIN);}}callbackContext.success("Google Mobile Ads SDK: "+MobileAds.getVersion());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.sdkInitialization');");});return true;case "targeting":cordova.getActivity().runOnUiThread(()->{final int TagForChildDirectedTreatment=args.optInt(0);final int TagForUnderAgeOfConsent=args.optInt(1);final String MaxAdContentRating=args.optString(2);try{this.SetTagForChildDirectedTreatment=TagForChildDirectedTreatment;this.SetTagForUnderAgeOfConsent=TagForUnderAgeOfConsent;this.SetMaxAdContentRating=MaxAdContentRating;_Targeting();}catch(Exception e){callbackContext.error(e.toString());}});return true;case "globalSettings":cordova.getActivity().runOnUiThread(()->{final boolean setAppMuted=args.optBoolean(0);final float setAppVolume=(float)args.optDouble(1);final boolean enableSameAppKey=args.optBoolean(2);final String npa=args.optString(3);final boolean enableCollapsible=args.optBoolean(4);final boolean responseInfo=args.optBoolean(5);try{this.SetAppMuted=setAppMuted;this.SetAppVolume=setAppVolume;this.EnableSameAppKey=enableSameAppKey;this.Npa=npa;this.isCollapsible=enableCollapsible;this.ResponseInfo=responseInfo;_globalSettings();}catch(Exception e){callbackContext.error(e.toString());}});return true;case "loadAppOpenAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.appOpenAdUnitId=adUnitId;this.appOpenAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putInt("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();AppOpenAd.load(mActivity,this.appOpenAdUnitId,adRequest,new AppOpenAd.AppOpenAdLoadCallback(){@Override public void onAdLoaded(@NonNull AppOpenAd ad){appOpenAd=ad;isAppOpenAdShow=true;if(appOpenAutoShow){cordova.getActivity().runOnUiThread(()-> appOpenAd.show(mActivity));_appOpenAdLoadCallback(callbackContext);}appOpenAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=appOpenAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.revenue');");}catch(JSONException e){callbackContext.error(e.getMessage());}});cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.loaded');");if(ResponseInfo){ResponseInfo responseInfo=appOpenAd.getResponseInfo();callbackContext.success(responseInfo.toString()+ '\n'+'\n'+bundleExtra);}}@Override public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){isAppOpenAdShow=false;callbackContext.error(loadAdError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.failed.loaded');");}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showAppOpenAd":if(isAppOpenAdShow){_appOpenAdLoadCallback(callbackContext);cordova.getActivity().runOnUiThread(()-> appOpenAd.show(mActivity));}else{callbackContext.error("The App Open Ad wasn't ready yet");}return true;case "loadInterstitialAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.interstitialAdUnitId=adUnitId;this.intAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putInt("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();InterstitialAd.load(mActivity,this.interstitialAdUnitId,adRequest,new InterstitialAdLoadCallback(){@Override public void onAdLoaded(@NonNull InterstitialAd interstitialAd){isinterstitialload=true;mInterstitialAd=interstitialAd;if(intAutoShow){_interstitialAdLoadCallback(callbackContext);cordova.getActivity().runOnUiThread(()-> mInterstitialAd.show(mActivity));}Log.i(TAG,"onAdLoaded");cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.loaded');");if(ResponseInfo){ResponseInfo responseInfo=interstitialAd.getResponseInfo();callbackContext.success(responseInfo.toString()+ '\n'+'\n'+bundleExtra);}mInterstitialAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=mInterstitialAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);}catch(JSONException e){callbackContext.error(e.getMessage());}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.revenue');");});}@Override public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){mInterstitialAd=null;isinterstitialload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.failed.load');");callbackContext.error(loadAdError.toString());}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showInterstitialAd":if(isinterstitialload){_interstitialAdLoadCallback(callbackContext);cordova.getActivity().runOnUiThread(()-> mInterstitialAd.show(mActivity));}else{callbackContext.error("The Interstitial ad wasn't ready yet");}return true;case "loadRewardedAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.rewardedAdUnitId=adUnitId;this.rewardedAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putInt("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();RewardedAd.load(mActivity,this.rewardedAdUnitId,adRequest,new RewardedAdLoadCallback(){public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){rewardedAd=null;isrewardedload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.failed.load');");callbackContext.error(loadAdError.toString());}@Override public void onAdLoaded(@NonNull RewardedAd ad){rewardedAd=ad;isrewardedload=true;isAdSkip=0;if(rewardedAutoShow){isAdSkip=1;rewardedAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.reward.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});_rewardedAdLoadCallback(callbackContext);}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.loaded');");if(ResponseInfo){ResponseInfo responseInfo=ad.getResponseInfo();callbackContext.success(responseInfo.toString()+ '\n'+'\n'+bundleExtra);}rewardedAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=rewardedAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);}catch(JSONException e){callbackContext.error(e.getMessage());}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.revenue');");});}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showRewardedAd":cordova.getActivity().runOnUiThread(()->{if(isrewardedload){isAdSkip=1;rewardedAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.reward.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});_rewardedAdLoadCallback(callbackContext);}else{callbackContext.error("The rewarded ad wasn't ready yet");}});return true;case "loadRewardedInterstitialAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.rewardedInterstitialAdUnitId=adUnitId;this.rIntAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putInt("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();RewardedInterstitialAd.load(mActivity,this.rewardedInterstitialAdUnitId,adRequest,new RewardedInterstitialAdLoadCallback(){@Override public void onAdLoaded(@NonNull RewardedInterstitialAd ad){rewardedInterstitialAd=ad;isrewardedInterstitialload=true;isAdSkip=0;if(rIntAutoShow){isAdSkip=1;rewardedInterstitialAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});_rewardedInterstitialAdLoadCallback(callbackContext);}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.loaded');");if(ResponseInfo){ResponseInfo responseInfo=ad.getResponseInfo();callbackContext.success(responseInfo.toString()+ '\n'+'\n'+bundleExtra);}rewardedInterstitialAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=rewardedInterstitialAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);}catch(JSONException e){callbackContext.error(e.getMessage());}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.revenue');");});}@Override public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){rewardedInterstitialAd=null;isrewardedInterstitialload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.failed.load');");callbackContext.error(loadAdError.toString());}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showRewardedInterstitialAd":cordova.getActivity().runOnUiThread(()->{if(isrewardedInterstitialload){isAdSkip=1;rewardedInterstitialAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});}else{callbackContext.error("The rewarded ad wasn't ready yet");}_rewardedInterstitialAdLoadCallback(callbackContext);});return true;case "loadBannerAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final String position=args.optString(1);final String size=args.optString(2);final String collapsible=args.optString(3);final int adaptive_Width=args.optInt(4);final boolean autoShow=args.optBoolean(5);try{this.bannerAdUnitId=adUnitId;this.Position=position;this.Size=size;this.AdaptiveWidth=adaptive_Width;this.Collapsible=collapsible;this.bannerAutoShow=autoShow;if(lock){_loadBannerAd(adUnitId,position,size,collapsible,adaptive_Width);}}catch(Exception e){callbackContext.error(e.toString());}});return true;case "getConsentRequest":cordova.getActivity().runOnUiThread(()->{try{ConsentRequestParameters params=new ConsentRequestParameters .Builder().build();consentInformation=UserMessagingPlatform.getConsentInformation(mActivity);consentInformation.requestConsentInfoUpdate(mActivity,params,()->{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.info.update');");if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.NOT_REQUIRED){callbackContext.success(ConsentInformation.ConsentStatus.NOT_REQUIRED);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.not_required');");}else if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.OBTAINED){callbackContext.success(ConsentInformation.ConsentStatus.OBTAINED);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.obtained');");}else if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.REQUIRED){callbackContext.success(ConsentInformation.ConsentStatus.REQUIRED);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.required');");if(consentInformation.isConsentFormAvailable()){UserMessagingPlatform.loadConsentForm(cordova.getContext(),consentForm -> consentForm.show(cordova.getActivity(),formError ->{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.failed.show');");callbackContext.error(String.valueOf(formError));}),formError -> callbackContext.error(formError.getMessage()));cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.failed.load.from');");}else{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.form.not.available');");}}else if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.UNKNOWN){callbackContext.success(ConsentInformation.ConsentStatus.UNKNOWN);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.unknown');");}},formError ->{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.info.update.failed');");callbackContext.error(formError.getMessage());});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showPrivacyOptionsForm":cordova.getActivity().runOnUiThread(this::consentInfoUpdate);return true;case "consentReset":cordova.getActivity().runOnUiThread(()->{if(consentInformation!=null){consentInformation.reset();}});return true;case "getIabTfc":cordova.getActivity().runOnUiThread(()->{Context context=this.cordova.getActivity().getApplicationContext();SharedPreferences mPreferences=PreferenceManager.getDefaultSharedPreferences(context);int gdprApplies=mPreferences.getInt("IABTCF_gdprApplies",0);String consentString=mPreferences.getString("IABTCF_TCString","");String purposeConsents=mPreferences.getString("IABTCF_PurposeConsents","");JSONObject userInfoJson=new JSONObject();try{userInfoJson.put("IABTCF_TCString",consentString);userInfoJson.put("IABTCF_PurposeConsents",purposeConsents);userInfoJson.put("IABTCF_gdprApplies",gdprApplies);callbackContext.success(userInfoJson);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.getIabTfc');");}catch(Exception e){callbackContext.error(e.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.getIabTfc.error');");}});return true;case "showBannerAd":cordova.getActivity().runOnUiThread(()->{if(isBannerPause==0){if(isBannerLoad){bannerViewLayout.addView(bannerView);isBannerShow=true;}}else if(isBannerPause==1){bannerView.setVisibility(View.VISIBLE);bannerView.resume();}});return true;case "hideBannerAd":cordova.getActivity().runOnUiThread(()->{if(isBannerShow){try{bannerView.setVisibility(View.GONE);bannerView.pause();isBannerLoad=false;isBannerPause=1;}catch(Exception e){callbackContext.error(e.toString());}}});return true;case "removeBannerAd":cordova.getActivity().runOnUiThread(()->{if(bannerView==null)return;RelativeLayout bannerViewLayout=(RelativeLayout)bannerView.getParent();if(bannerViewLayout!=null){bannerViewLayout.removeView(bannerView);bannerView.destroy();bannerView=null;isBannerLoad=false;isBannerShow=false;isBannerPause=2;lock=true;bannerAdImpression=0;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.remove');");}});return true;}return false;}private void _loadBannerAd(String adUnitId,String position,String size,String collapsible,int adaptive_Width){try{if(bannerViewLayout==null){bannerViewLayout=new RelativeLayout(mActivity);RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT);try{((ViewGroup)(((View)Objects.requireNonNull(webView.getClass().getMethod("getView").invoke(webView))).getParent())).addView(bannerViewLayout,params);}catch(Exception e){((ViewGroup)webView).addView(bannerViewLayout,params);}}bannerView=new AdView(mActivity);if(Objects.equals(size,"BANNER")){bannerView.setAdSize(AdSize.BANNER);}else if(Objects.equals(size,"LARGE_BANNER")){bannerView.setAdSize(AdSize.LARGE_BANNER);}else if(Objects.equals(size,"MEDIUM_RECTANGLE")){bannerView.setAdSize(AdSize.MEDIUM_RECTANGLE);}else if(Objects.equals(size,"FULL_BANNER")){bannerView.setAdSize(AdSize.FULL_BANNER);}else if(Objects.equals(size,"LEADERBOARD")){bannerView.setAdSize(AdSize.LEADERBOARD);}else if(Objects.equals(size,"FLUID")){bannerView.setAdSize(AdSize.FLUID);}else if(Objects.equals(size,"ANCHORED")){bannerView.setAdSize(AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(mActivity,adaptive_Width));}else if(Objects.equals(size,"IN_LINE")){bannerView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(mActivity,adaptive_Width));}else if(Objects.equals(size,"FULL_WIDTH")){bannerView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(mActivity,AdSize.FULL_WIDTH));}else{bannerView.setAdSize(AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(mActivity,AdSize.FULL_WIDTH));}bannerView.setAdUnitId(adUnitId);Bundle bundleExtra=new Bundle();if(isCollapsible){bundleExtra.putString("collapsible",collapsible);}bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putInt("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();bannerView.loadAd(adRequest);bannerView.setAdListener(bannerAdListener);RelativeLayout.LayoutParams bannerParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);switch(position){case "top-right":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);bannerParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);break;case "top-center":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);bannerParams.addRule(RelativeLayout.CENTER_HORIZONTAL);break;case "left":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);bannerParams.addRule(RelativeLayout.CENTER_VERTICAL);break;case "center":bannerParams.addRule(RelativeLayout.CENTER_HORIZONTAL);bannerParams.addRule(RelativeLayout.CENTER_VERTICAL);break;case "right":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);bannerParams.addRule(RelativeLayout.CENTER_VERTICAL);break;case "bottom-center":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);bannerParams.addRule(RelativeLayout.CENTER_HORIZONTAL);break;case "bottom-right":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);bannerParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);break;default:bannerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);bannerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);break;}bannerView.setLayoutParams(bannerParams);bannerViewLayout.bringToFront();}catch(Exception e){PUBLIC_CALLBACKS.error(e.toString());}}private final AdListener bannerAdListener=new AdListener(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.click');");}@Override public void onAdClosed(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.close');");}@Override public void onAdFailedToLoad(@NonNull LoadAdError adError){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.failed.load');");isBannerLoad=false;isBannerShow=false;lock=true;PUBLIC_CALLBACKS.error(adError.toString());}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.impression');");}@Override public void onAdLoaded(){isBannerLoad=true;bannerAdImpression=1;isBannerPause=0;lock=false;if(bannerAutoShow){bannerViewLayout.addView(bannerView);isBannerPause=0;}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.load');");bannerView.setOnPaidEventListener(bannerPaidAdListener);if(ResponseInfo){Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",Npa);bundleExtra.putInt("is_designed_for_families",SetTagForChildDirectedTreatment);bundleExtra.putInt("under_age_of_consent",SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",SetMaxAdContentRating);try{ResponseInfo responseInfo=bannerView.getResponseInfo();assert responseInfo!=null;PUBLIC_CALLBACKS.success(responseInfo.toString()+ '\n'+'\n'+bundleExtra);}catch(NullPointerException e){e.printStackTrace();}}}@Override public void onAdOpened(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.open');");}};private final OnPaidEventListener bannerPaidAdListener=new OnPaidEventListener(){@Override public void onPaidEvent(@NonNull AdValue adValue){long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=bannerView.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);isBannerLoad=false;PUBLIC_CALLBACKS.success(result);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.revenue');");}catch(JSONException e){PUBLIC_CALLBACKS.error(e.getMessage());}}};public boolean isPrivacyOptionsRequired(){return consentInformation.getPrivacyOptionsRequirementStatus()==ConsentInformation.PrivacyOptionsRequirementStatus.REQUIRED;}private void consentInfoUpdate(){ConsentRequestParameters params=new ConsentRequestParameters .Builder().setTagForUnderAgeOfConsent(false).build();consentInformation=UserMessagingPlatform.getConsentInformation(mActivity);consentInformation.requestConsentInfoUpdate(mActivity,params,(ConsentInformation.OnConsentInfoUpdateSuccessListener)this::OptionsMenu,(ConsentInformation.OnConsentInfoUpdateFailureListener)requestConsentError ->{PUBLIC_CALLBACKS.error(requestConsentError.getMessage());});}private void OptionsMenu(){try{UserMessagingPlatform.loadAndShowConsentFormIfRequired(mActivity,(ConsentForm.OnConsentFormDismissedListener)loadAndShowError ->{if(loadAndShowError!=null){PUBLIC_CALLBACKS.error(loadAndShowError.getMessage());}if(isPrivacyOptionsRequired()){invalidateOptionsMenu();}});}catch(Exception e){throw new RuntimeException(e);}}private void invalidateOptionsMenu(){UserMessagingPlatform.showPrivacyOptionsForm(mActivity,formError ->{if(formError!=null){PUBLIC_CALLBACKS.error(formError.getMessage());}});}private void _appOpenAdLoadCallback(CallbackContext callbackContext){appOpenAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdDismissedFullScreenContent(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.dismissed');");View mainView=getView();if(mainView!=null){mainView.requestFocus();}}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.failed.show');");callbackContext.error(adError.toString());appOpenAd=null;}@Override public void onAdShowedFullScreenContent(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.show');");}});}private void _interstitialAdLoadCallback(CallbackContext callbackContext){mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.click');");}@Override public void onAdDismissedFullScreenContent(){mInterstitialAd=null;isinterstitialload=false;View mainView=getView();if(mainView!=null){mainView.requestFocus();}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.dismissed');");}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){mInterstitialAd=null;isinterstitialload=false;callbackContext.error(adError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.failed.show');");}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.impression');");}@Override public void onAdShowedFullScreenContent(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.show');");}});}private void _rewardedAdLoadCallback(CallbackContext callbackContext){rewardedAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.click');");}@Override public void onAdDismissedFullScreenContent(){if(isAdSkip!=2){rewardedAd=null;isrewardedload=false;View mainView=getView();if(mainView!=null){mainView.requestFocus();}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.ad.skip');");}rewardedAd=null;isrewardedload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.dismissed');");}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){rewardedAd=null;isrewardedload=false;callbackContext.error(adError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.failed.show');");}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.impression');");}@Override public void onAdShowedFullScreenContent(){isAdSkip=1;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.show');");}});}private void _rewardedInterstitialAdLoadCallback(CallbackContext callbackContext){rewardedInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.click');");}@Override public void onAdDismissedFullScreenContent(){if(isAdSkip!=2){rewardedInterstitialAd=null;isrewardedInterstitialload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.ad.skip');");}rewardedInterstitialAd=null;isrewardedInterstitialload=false;View mainView=getView();if(mainView!=null){mainView.requestFocus();}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.dismissed');");}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){rewardedInterstitialAd=null;isrewardedInterstitialload=false;callbackContext.error(adError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.failed.show');");}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.impression');");}@Override public void onAdShowedFullScreenContent(){isAdSkip=1;Log.d(TAG,"Ad showed fullscreen content.");cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.showed');");}});}public void _globalSettings(){MobileAds.setAppMuted(this.SetAppMuted);MobileAds.setAppVolume(this.SetAppVolume);MobileAds.enableSameAppKey(this.EnableSameAppKey);}public void _Targeting(){RequestConfiguration.Builder requestConfiguration=MobileAds.getRequestConfiguration().toBuilder();if(SetTagForChildDirectedTreatment==-1){requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED);}else if(SetTagForChildDirectedTreatment==0){requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE);}else if(SetTagForChildDirectedTreatment==1){requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE);}else{requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED);}if(SetTagForUnderAgeOfConsent==-1){requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED);}else if(SetTagForUnderAgeOfConsent==0){requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE);}else if(SetTagForUnderAgeOfConsent==1){requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE);}else{requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED);}if(Objects.equals(SetMaxAdContentRating,"")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED);}else if(Objects.equals(SetMaxAdContentRating,"T")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_T);}else if(Objects.equals(SetMaxAdContentRating,"PG")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_PG);}else if(Objects.equals(SetMaxAdContentRating,"MA")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_MA);}else if(Objects.equals(SetMaxAdContentRating,"G")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_G);}else{requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED);}MobileAds.setRequestConfiguration(requestConfiguration.build());}private View getView(){if(View.class.isAssignableFrom(CordovaWebView.class)){return(View)cWebView;}return cordova.getActivity().getWindow().getDecorView().findViewById(android.R.id.content);}@Override public void onPause(boolean multitasking){if(bannerView!=null){bannerView.pause();}super.onPause(multitasking);}@Override public void onResume(boolean multitasking){super.onResume(multitasking);if(bannerView!=null){bannerView.resume();}}@Override public void onDestroy(){if(bannerView!=null){bannerView.destroy();bannerView=null;}if(bannerViewLayout!=null){ViewGroup parentView=(ViewGroup)bannerViewLayout.getParent();if(parentView!=null){parentView.removeView(bannerViewLayout);}bannerViewLayout=null;}bannerAdImpression=0;super.onDestroy();}}
|
1
|
+
package emi.indo.cordova.plugin.admob;import android.app.Activity;import android.content.Context;import android.content.SharedPreferences;import android.content.res.Configuration;import android.os.Bundle;import android.util.Log;import android.view.View;import android.view.ViewGroup;import android.widget.RelativeLayout;import androidx.annotation.NonNull;import androidx.preference.PreferenceManager;import com.google.ads.mediation.admob.AdMobAdapter;import com.google.android.gms.ads.AdError;import com.google.android.gms.ads.AdListener;import com.google.android.gms.ads.AdRequest;import com.google.android.gms.ads.AdSize;import com.google.android.gms.ads.AdValue;import com.google.android.gms.ads.AdView;import com.google.android.gms.ads.FullScreenContentCallback;import com.google.android.gms.ads.LoadAdError;import com.google.android.gms.ads.MobileAds;import com.google.android.gms.ads.OnPaidEventListener;import com.google.android.gms.ads.RequestConfiguration;import com.google.android.gms.ads.ResponseInfo;import com.google.android.gms.ads.appopen.AppOpenAd;import com.google.android.gms.ads.initialization.AdapterStatus;import com.google.android.gms.ads.interstitial.InterstitialAd;import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;import com.google.android.gms.ads.rewarded.RewardedAd;import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback;import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAd;import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAdLoadCallback;import com.google.android.ump.ConsentForm;import com.google.android.ump.ConsentInformation;import com.google.android.ump.ConsentRequestParameters;import com.google.android.ump.UserMessagingPlatform;import org.apache.cordova.CallbackContext;import org.apache.cordova.CordovaInterface;import org.apache.cordova.CordovaPlugin;import org.apache.cordova.CordovaWebView;import org.json.JSONArray;import org.json.JSONException;import org.json.JSONObject;import java.util.Map;import java.util.Objects;public class emiAdmobPlugin extends CordovaPlugin{private static final String TAG="emiAdmobPlugin";private CallbackContext PUBLIC_CALLBACKS=null;private InterstitialAd mInterstitialAd;private RewardedAd rewardedAd;private RewardedInterstitialAd rewardedInterstitialAd;private CordovaWebView cWebView;private boolean isAppOpenAdShow=false;static boolean isinterstitialload=false;static boolean isrewardedInterstitialload=false;static boolean isrewardedload=false;int isBannerPause=0;String Npa;String Position;String Size;int AdaptiveWidth=320;Boolean ResponseInfo=false;int bannerAdImpression=0;private int isAdSkip=0;int SetTagForChildDirectedTreatment=-1;Boolean SetTagForUnderAgeOfConsent=false;String SetMaxAdContentRating="G";String appOpenAdUnitId;String bannerAdUnitId;String interstitialAdUnitId;String rewardedInterstitialAdUnitId;String rewardedAdUnitId;boolean SetAppMuted=false;float SetAppVolume=1;boolean EnableSameAppKey=false;private ConsentInformation consentInformation;private RelativeLayout bannerViewLayout;private AdView bannerView;private boolean isBannerLoad=false;private boolean isBannerShow=false;Boolean bannerAutoShow=false;Boolean appOpenAutoShow=false;Boolean intAutoShow=false;Boolean rewardedAutoShow=false;Boolean rIntAutoShow=false;String Collapsible;Boolean isCollapsible=false;Boolean lock=true;protected Activity mActivity;protected Context mContext;private AppOpenAd appOpenAd;int orientation=0;public void initialize(CordovaInterface cordova,CordovaWebView webView){super.initialize(cordova,webView);cWebView=webView;mActivity=this.cordova.getActivity();mContext=mActivity.getApplicationContext();int orientation=mActivity.getResources().getConfiguration().orientation;if(orientation==Configuration.ORIENTATION_PORTRAIT){this.orientation=0;}else{this.orientation=1;}}public boolean execute(String action,JSONArray args,final CallbackContext callbackContext)throws JSONException{PUBLIC_CALLBACKS=callbackContext;switch(action){case "initialize":Log.d(TAG,"Google Mobile Ads SDK: "+MobileAds.getVersion());MobileAds.initialize(mActivity,initializationStatus ->{Map<String,AdapterStatus> statusMap=initializationStatus.getAdapterStatusMap();for(String adapterClass:statusMap.keySet()){AdapterStatus status=statusMap.get(adapterClass);if(status!=null){Log.d(TAG,String.format("Adapter name:%s,Description:%s,Latency:%d",adapterClass,status.getDescription(),status.getLatency()));}else{callbackContext.error(MobileAds.ERROR_DOMAIN);}}callbackContext.success("Google Mobile Ads SDK: "+MobileAds.getVersion());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.sdkInitialization');");});return true;case "targeting":cordova.getActivity().runOnUiThread(()->{final int childDirectedTreatment=args.optInt(0);final boolean underAgeOfConsent=args.optBoolean(1);final String contentRating=args.optString(2);try{this.SetTagForChildDirectedTreatment=childDirectedTreatment;this.SetTagForUnderAgeOfConsent=underAgeOfConsent;this.SetMaxAdContentRating=contentRating;_Targeting();}catch(Exception e){callbackContext.error(e.toString());}});return true;case "globalSettings":cordova.getActivity().runOnUiThread(()->{final boolean setAppMuted=args.optBoolean(0);final float setAppVolume=(float)args.optDouble(1);final boolean publisherFirstPartyIdEnabled=args.optBoolean(2);final String npa=args.optString(3);final boolean enableCollapsible=args.optBoolean(4);final boolean responseInfo=args.optBoolean(5);try{this.SetAppMuted=setAppMuted;this.SetAppVolume=setAppVolume;this.EnableSameAppKey=publisherFirstPartyIdEnabled;this.Npa=npa;this.isCollapsible=enableCollapsible;this.ResponseInfo=responseInfo;_globalSettings();}catch(Exception e){callbackContext.error(e.toString());}});return true;case "loadAppOpenAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.appOpenAdUnitId=adUnitId;this.appOpenAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putBoolean("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();AppOpenAd.load(mActivity,this.appOpenAdUnitId,adRequest,new AppOpenAd.AppOpenAdLoadCallback(){@Override public void onAdLoaded(@NonNull AppOpenAd ad){appOpenAd=ad;isAppOpenAdShow=true;if(appOpenAutoShow){cordova.getActivity().runOnUiThread(()-> appOpenAd.show(mActivity));_appOpenAdLoadCallback(callbackContext);}appOpenAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=appOpenAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.revenue');");}catch(JSONException e){callbackContext.error(e.getMessage());}});cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.loaded');");if(ResponseInfo){JSONObject result=new JSONObject();ResponseInfo responseInfo=appOpenAd.getResponseInfo();try{result.put("getResponseId",responseInfo.getResponseId());result.put("getAdapterResponses",responseInfo.getAdapterResponses());result.put("getLoadedAdapter",responseInfo.getLoadedAdapterResponseInfo());result.put("getResponseExtras",responseInfo.getResponseExtras());result.put("bundleExtra",bundleExtra);PUBLIC_CALLBACKS.success(result);}catch(JSONException e){PUBLIC_CALLBACKS.error(e.getMessage());}}}@Override public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){isAppOpenAdShow=false;callbackContext.error(loadAdError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.failed.loaded');");}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showAppOpenAd":if(isAppOpenAdShow){_appOpenAdLoadCallback(callbackContext);cordova.getActivity().runOnUiThread(()-> appOpenAd.show(mActivity));}else{callbackContext.error("The App Open Ad wasn't ready yet");}return true;case "loadInterstitialAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.interstitialAdUnitId=adUnitId;this.intAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putBoolean("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();InterstitialAd.load(mActivity,this.interstitialAdUnitId,adRequest,new InterstitialAdLoadCallback(){@Override public void onAdLoaded(@NonNull InterstitialAd interstitialAd){isinterstitialload=true;mInterstitialAd=interstitialAd;if(intAutoShow){_interstitialAdLoadCallback(callbackContext);cordova.getActivity().runOnUiThread(()-> mInterstitialAd.show(mActivity));}Log.i(TAG,"onAdLoaded");cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.loaded');");if(ResponseInfo){JSONObject result=new JSONObject();ResponseInfo responseInfo=interstitialAd.getResponseInfo();try{result.put("getResponseId",responseInfo.getResponseId());result.put("getAdapterResponses",responseInfo.getAdapterResponses());result.put("getLoadedAdapter",responseInfo.getLoadedAdapterResponseInfo());result.put("getResponseExtras",responseInfo.getResponseExtras());result.put("bundleExtra",bundleExtra);PUBLIC_CALLBACKS.success(result);}catch(JSONException e){PUBLIC_CALLBACKS.error(e.getMessage());}}mInterstitialAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=mInterstitialAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);}catch(JSONException e){callbackContext.error(e.getMessage());}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.revenue');");});}@Override public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){mInterstitialAd=null;isinterstitialload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.failed.load');");callbackContext.error(loadAdError.toString());}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showInterstitialAd":if(isinterstitialload){_interstitialAdLoadCallback(callbackContext);cordova.getActivity().runOnUiThread(()-> mInterstitialAd.show(mActivity));}else{callbackContext.error("The Interstitial ad wasn't ready yet");}return true;case "loadRewardedAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.rewardedAdUnitId=adUnitId;this.rewardedAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putBoolean("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();RewardedAd.load(mActivity,this.rewardedAdUnitId,adRequest,new RewardedAdLoadCallback(){public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){rewardedAd=null;isrewardedload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.failed.load');");callbackContext.error(loadAdError.toString());}@Override public void onAdLoaded(@NonNull RewardedAd ad){rewardedAd=ad;isrewardedload=true;isAdSkip=0;if(rewardedAutoShow){isAdSkip=1;rewardedAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.reward.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});_rewardedAdLoadCallback(callbackContext);}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.loaded');");if(ResponseInfo){JSONObject result=new JSONObject();ResponseInfo responseInfo=ad.getResponseInfo();try{result.put("getResponseId",responseInfo.getResponseId());result.put("getAdapterResponses",responseInfo.getAdapterResponses());result.put("getLoadedAdapter",responseInfo.getLoadedAdapterResponseInfo());result.put("getResponseExtras",responseInfo.getResponseExtras());result.put("bundleExtra",bundleExtra);PUBLIC_CALLBACKS.success(result);}catch(JSONException e){PUBLIC_CALLBACKS.error(e.getMessage());}}rewardedAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=rewardedAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);}catch(JSONException e){callbackContext.error(e.getMessage());}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.revenue');");});}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showRewardedAd":cordova.getActivity().runOnUiThread(()->{if(isrewardedload){isAdSkip=1;rewardedAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.reward.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});_rewardedAdLoadCallback(callbackContext);}else{callbackContext.error("The rewarded ad wasn't ready yet");}});return true;case "loadRewardedInterstitialAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final boolean autoShow=args.optBoolean(1);try{this.rewardedInterstitialAdUnitId=adUnitId;this.rIntAutoShow=autoShow;Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putBoolean("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();RewardedInterstitialAd.load(mActivity,this.rewardedInterstitialAdUnitId,adRequest,new RewardedInterstitialAdLoadCallback(){@Override public void onAdLoaded(@NonNull RewardedInterstitialAd ad){rewardedInterstitialAd=ad;isrewardedInterstitialload=true;isAdSkip=0;if(rIntAutoShow){isAdSkip=1;rewardedInterstitialAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});_rewardedInterstitialAdLoadCallback(callbackContext);}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.loaded');");if(ResponseInfo){JSONObject result=new JSONObject();ResponseInfo responseInfo=ad.getResponseInfo();try{result.put("getResponseId",responseInfo.getResponseId());result.put("getAdapterResponses",responseInfo.getAdapterResponses());result.put("getLoadedAdapter",responseInfo.getLoadedAdapterResponseInfo());result.put("getResponseExtras",responseInfo.getResponseExtras());result.put("bundleExtra",bundleExtra);PUBLIC_CALLBACKS.success(result);}catch(JSONException e){PUBLIC_CALLBACKS.error(e.getMessage());}}rewardedInterstitialAd.setOnPaidEventListener(adValue ->{long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=rewardedInterstitialAd.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);callbackContext.success(result);}catch(JSONException e){callbackContext.error(e.getMessage());}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.revenue');");});}@Override public void onAdFailedToLoad(@NonNull LoadAdError loadAdError){rewardedInterstitialAd=null;isrewardedInterstitialload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.failed.load');");callbackContext.error(loadAdError.toString());}});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showRewardedInterstitialAd":cordova.getActivity().runOnUiThread(()->{if(isrewardedInterstitialload){isAdSkip=1;rewardedInterstitialAd.show(mActivity,rewardItem ->{isAdSkip=2;int rewardAmount=rewardItem.getAmount();String rewardType=rewardItem.getType();cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.userEarnedReward');");callbackContext.success("rewardAmount:"+rewardAmount+"rewardType:"+rewardType);});}else{callbackContext.error("The rewarded ad wasn't ready yet");}_rewardedInterstitialAdLoadCallback(callbackContext);});return true;case "loadBannerAd":cordova.getActivity().runOnUiThread(()->{final String adUnitId=args.optString(0);final String position=args.optString(1);final String size=args.optString(2);final String collapsible=args.optString(3);final int adaptive_Width=args.optInt(4);final boolean autoShow=args.optBoolean(5);try{this.bannerAdUnitId=adUnitId;this.Position=position;this.Size=size;this.AdaptiveWidth=adaptive_Width;this.Collapsible=collapsible;this.bannerAutoShow=autoShow;if(lock){_loadBannerAd(adUnitId,position,size,collapsible,adaptive_Width);}}catch(Exception e){callbackContext.error(e.toString());}});return true;case "getConsentRequest":cordova.getActivity().runOnUiThread(()->{try{ConsentRequestParameters params=new ConsentRequestParameters .Builder().build();consentInformation=UserMessagingPlatform.getConsentInformation(mActivity);consentInformation.requestConsentInfoUpdate(mActivity,params,()->{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.info.update');");if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.NOT_REQUIRED){callbackContext.success(ConsentInformation.ConsentStatus.NOT_REQUIRED);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.not_required');");}else if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.OBTAINED){callbackContext.success(ConsentInformation.ConsentStatus.OBTAINED);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.obtained');");}else if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.REQUIRED){callbackContext.success(ConsentInformation.ConsentStatus.REQUIRED);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.required');");if(consentInformation.isConsentFormAvailable()){UserMessagingPlatform.loadConsentForm(cordova.getContext(),consentForm -> consentForm.show(cordova.getActivity(),formError ->{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.failed.show');");callbackContext.error(String.valueOf(formError));}),formError -> callbackContext.error(formError.getMessage()));cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.failed.load.from');");}else{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.form.not.available');");}}else if(consentInformation.getConsentStatus()==ConsentInformation.ConsentStatus.UNKNOWN){callbackContext.success(ConsentInformation.ConsentStatus.UNKNOWN);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.status.unknown');");}},formError ->{cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.consent.info.update.failed');");callbackContext.error(formError.getMessage());});}catch(Exception e){callbackContext.error(e.toString());}});return true;case "showPrivacyOptionsForm":cordova.getActivity().runOnUiThread(this::consentInfoUpdate);return true;case "consentReset":cordova.getActivity().runOnUiThread(()->{if(consentInformation!=null){consentInformation.reset();}});return true;case "getIabTfc":cordova.getActivity().runOnUiThread(()->{Context context=this.cordova.getActivity().getApplicationContext();SharedPreferences mPreferences=PreferenceManager.getDefaultSharedPreferences(context);int gdprApplies=mPreferences.getInt("IABTCF_gdprApplies",0);String consentString=mPreferences.getString("IABTCF_TCString","");String purposeConsents=mPreferences.getString("IABTCF_PurposeConsents","");JSONObject userInfoJson=new JSONObject();try{userInfoJson.put("IABTCF_TCString",consentString);userInfoJson.put("IABTCF_PurposeConsents",purposeConsents);userInfoJson.put("IABTCF_gdprApplies",gdprApplies);callbackContext.success(userInfoJson);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.getIabTfc');");}catch(Exception e){callbackContext.error(e.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.getIabTfc.error');");}});return true;case "showBannerAd":cordova.getActivity().runOnUiThread(()->{if(isBannerPause==0){if(isBannerLoad){bannerViewLayout.addView(bannerView);isBannerShow=true;}}else if(isBannerPause==1){bannerView.setVisibility(View.VISIBLE);bannerView.resume();}});return true;case "hideBannerAd":cordova.getActivity().runOnUiThread(()->{if(isBannerShow){try{bannerView.setVisibility(View.GONE);bannerView.pause();isBannerLoad=false;isBannerPause=1;}catch(Exception e){callbackContext.error(e.toString());}}});return true;case "removeBannerAd":cordova.getActivity().runOnUiThread(()->{if(bannerView==null)return;RelativeLayout bannerViewLayout=(RelativeLayout)bannerView.getParent();if(bannerViewLayout!=null){bannerViewLayout.removeView(bannerView);bannerView.destroy();bannerView=null;isBannerLoad=false;isBannerShow=false;isBannerPause=2;lock=true;bannerAdImpression=0;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.remove');");}});return true;}return false;}private void _loadBannerAd(String adUnitId,String position,String size,String collapsible,int adaptive_Width){try{if(bannerViewLayout==null){bannerViewLayout=new RelativeLayout(mActivity);RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.MATCH_PARENT);try{((ViewGroup)(((View)Objects.requireNonNull(webView.getClass().getMethod("getView").invoke(webView))).getParent())).addView(bannerViewLayout,params);}catch(Exception e){((ViewGroup)webView).addView(bannerViewLayout,params);}}bannerView=new AdView(mActivity);if(Objects.equals(size,"BANNER")){bannerView.setAdSize(AdSize.BANNER);}else if(Objects.equals(size,"LARGE_BANNER")){bannerView.setAdSize(AdSize.LARGE_BANNER);}else if(Objects.equals(size,"MEDIUM_RECTANGLE")){bannerView.setAdSize(AdSize.MEDIUM_RECTANGLE);}else if(Objects.equals(size,"FULL_BANNER")){bannerView.setAdSize(AdSize.FULL_BANNER);}else if(Objects.equals(size,"LEADERBOARD")){bannerView.setAdSize(AdSize.LEADERBOARD);}else if(Objects.equals(size,"FLUID")){bannerView.setAdSize(AdSize.FLUID);}else if(Objects.equals(size,"ANCHORED")){bannerView.setAdSize(AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(mActivity,adaptive_Width));}else if(Objects.equals(size,"IN_LINE")){bannerView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(mActivity,adaptive_Width));}else if(Objects.equals(size,"FULL_WIDTH")){bannerView.setAdSize(AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(mActivity,AdSize.FULL_WIDTH));}else{bannerView.setAdSize(AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(mActivity,AdSize.FULL_WIDTH));}bannerView.setAdUnitId(adUnitId);Bundle bundleExtra=new Bundle();if(isCollapsible){bundleExtra.putString("collapsible",collapsible);}bundleExtra.putString("npa",this.Npa);bundleExtra.putInt("is_designed_for_families",this.SetTagForChildDirectedTreatment);bundleExtra.putBoolean("under_age_of_consent",this.SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",this.SetMaxAdContentRating);AdRequest adRequest=new AdRequest.Builder().addNetworkExtrasBundle(AdMobAdapter.class,bundleExtra).build();bannerView.loadAd(adRequest);bannerView.setAdListener(bannerAdListener);RelativeLayout.LayoutParams bannerParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);switch(position){case "top-right":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);bannerParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);break;case "top-center":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);bannerParams.addRule(RelativeLayout.CENTER_HORIZONTAL);break;case "left":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);bannerParams.addRule(RelativeLayout.CENTER_VERTICAL);break;case "center":bannerParams.addRule(RelativeLayout.CENTER_HORIZONTAL);bannerParams.addRule(RelativeLayout.CENTER_VERTICAL);break;case "right":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);bannerParams.addRule(RelativeLayout.CENTER_VERTICAL);break;case "bottom-center":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);bannerParams.addRule(RelativeLayout.CENTER_HORIZONTAL);break;case "bottom-right":bannerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);bannerParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);break;default:bannerParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);bannerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);break;}bannerView.setLayoutParams(bannerParams);bannerViewLayout.bringToFront();}catch(Exception e){PUBLIC_CALLBACKS.error(e.toString());}}private final AdListener bannerAdListener=new AdListener(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.click');");}@Override public void onAdClosed(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.close');");}@Override public void onAdFailedToLoad(@NonNull LoadAdError adError){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.failed.load');");isBannerLoad=false;isBannerShow=false;lock=true;PUBLIC_CALLBACKS.error(adError.toString());}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.impression');");}@Override public void onAdLoaded(){isBannerLoad=true;bannerAdImpression=1;isBannerPause=0;lock=false;if(bannerAutoShow){bannerViewLayout.addView(bannerView);isBannerPause=0;}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.load');");bannerView.setOnPaidEventListener(bannerPaidAdListener);if(ResponseInfo){Bundle bundleExtra=new Bundle();bundleExtra.putString("npa",Npa);bundleExtra.putInt("is_designed_for_families",SetTagForChildDirectedTreatment);bundleExtra.putBoolean("under_age_of_consent",SetTagForUnderAgeOfConsent);bundleExtra.putString("max_ad_content_rating",SetMaxAdContentRating);JSONObject result=new JSONObject();ResponseInfo responseInfo=bannerView.getResponseInfo();try{assert responseInfo!=null;result.put("getResponseId",responseInfo.getResponseId());result.put("getAdapterResponses",responseInfo.getAdapterResponses());result.put("getLoadedAdapter",responseInfo.getLoadedAdapterResponseInfo());result.put("getResponseExtras",responseInfo.getResponseExtras());result.put("bundleExtra",bundleExtra);PUBLIC_CALLBACKS.success(result);}catch(JSONException e){PUBLIC_CALLBACKS.error(e.getMessage());}}}@Override public void onAdOpened(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.open');");}};private final OnPaidEventListener bannerPaidAdListener=new OnPaidEventListener(){@Override public void onPaidEvent(@NonNull AdValue adValue){long valueMicros=adValue.getValueMicros();String currencyCode=adValue.getCurrencyCode();int precision=adValue.getPrecisionType();String adUnitId=bannerView.getAdUnitId();JSONObject result=new JSONObject();try{result.put("micros",valueMicros);result.put("currency",currencyCode);result.put("precision",precision);result.put("adUnitId",adUnitId);isBannerLoad=false;PUBLIC_CALLBACKS.success(result);cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.banner.revenue');");}catch(JSONException e){PUBLIC_CALLBACKS.error(e.getMessage());}}};public boolean isPrivacyOptionsRequired(){return consentInformation.getPrivacyOptionsRequirementStatus()==ConsentInformation.PrivacyOptionsRequirementStatus.REQUIRED;}private void consentInfoUpdate(){ConsentRequestParameters params=new ConsentRequestParameters .Builder().setTagForUnderAgeOfConsent(false).build();consentInformation=UserMessagingPlatform.getConsentInformation(mActivity);consentInformation.requestConsentInfoUpdate(mActivity,params,(ConsentInformation.OnConsentInfoUpdateSuccessListener)this::OptionsMenu,(ConsentInformation.OnConsentInfoUpdateFailureListener)requestConsentError ->{PUBLIC_CALLBACKS.error(requestConsentError.getMessage());});}private void OptionsMenu(){try{UserMessagingPlatform.loadAndShowConsentFormIfRequired(mActivity,(ConsentForm.OnConsentFormDismissedListener)loadAndShowError ->{if(loadAndShowError!=null){PUBLIC_CALLBACKS.error(loadAndShowError.getMessage());}if(isPrivacyOptionsRequired()){invalidateOptionsMenu();}});}catch(Exception e){throw new RuntimeException(e);}}private void invalidateOptionsMenu(){UserMessagingPlatform.showPrivacyOptionsForm(mActivity,formError ->{if(formError!=null){PUBLIC_CALLBACKS.error(formError.getMessage());}});}private void _appOpenAdLoadCallback(CallbackContext callbackContext){appOpenAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdDismissedFullScreenContent(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.dismissed');");View mainView=getView();if(mainView!=null){mainView.requestFocus();}}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.failed.show');");callbackContext.error(adError.toString());appOpenAd=null;}@Override public void onAdShowedFullScreenContent(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.appOpenAd.show');");}});}private void _interstitialAdLoadCallback(CallbackContext callbackContext){mInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.click');");}@Override public void onAdDismissedFullScreenContent(){mInterstitialAd=null;isinterstitialload=false;View mainView=getView();if(mainView!=null){mainView.requestFocus();}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.dismissed');");}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){mInterstitialAd=null;isinterstitialload=false;callbackContext.error(adError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.failed.show');");}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.impression');");}@Override public void onAdShowedFullScreenContent(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.interstitial.show');");}});}private void _rewardedAdLoadCallback(CallbackContext callbackContext){rewardedAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.click');");}@Override public void onAdDismissedFullScreenContent(){if(isAdSkip!=2){rewardedAd=null;isrewardedload=false;View mainView=getView();if(mainView!=null){mainView.requestFocus();}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.ad.skip');");}rewardedAd=null;isrewardedload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.dismissed');");}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){rewardedAd=null;isrewardedload=false;callbackContext.error(adError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.failed.show');");}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.impression');");}@Override public void onAdShowedFullScreenContent(){isAdSkip=1;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewarded.show');");}});}private void _rewardedInterstitialAdLoadCallback(CallbackContext callbackContext){rewardedInterstitialAd.setFullScreenContentCallback(new FullScreenContentCallback(){@Override public void onAdClicked(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.click');");}@Override public void onAdDismissedFullScreenContent(){if(isAdSkip!=2){rewardedInterstitialAd=null;isrewardedInterstitialload=false;cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.ad.skip');");}rewardedInterstitialAd=null;isrewardedInterstitialload=false;View mainView=getView();if(mainView!=null){mainView.requestFocus();}cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.dismissed');");}@Override public void onAdFailedToShowFullScreenContent(@NonNull AdError adError){rewardedInterstitialAd=null;isrewardedInterstitialload=false;callbackContext.error(adError.toString());cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.failed.show');");}@Override public void onAdImpression(){cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.impression');");}@Override public void onAdShowedFullScreenContent(){isAdSkip=1;Log.d(TAG,"Ad showed fullscreen content.");cWebView.loadUrl("javascript:cordova.fireDocumentEvent('on.rewardedInt.showed');");}});}public void _globalSettings(){MobileAds.setAppMuted(this.SetAppMuted);MobileAds.setAppVolume(this.SetAppVolume);MobileAds.putPublisherFirstPartyIdEnabled(this.EnableSameAppKey);}public void _Targeting(){RequestConfiguration.Builder requestConfiguration=MobileAds.getRequestConfiguration().toBuilder();if(SetTagForChildDirectedTreatment==-1){requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED);}else if(SetTagForChildDirectedTreatment==0){requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE);}else if(SetTagForChildDirectedTreatment==1){requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE);}else{requestConfiguration.setTagForChildDirectedTreatment(RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED);}if(SetTagForUnderAgeOfConsent){requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE);}else{requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE);}if(Objects.equals(SetMaxAdContentRating,"")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED);}else if(Objects.equals(SetMaxAdContentRating,"T")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_T);}else if(Objects.equals(SetMaxAdContentRating,"PG")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_PG);}else if(Objects.equals(SetMaxAdContentRating,"MA")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_MA);}else if(Objects.equals(SetMaxAdContentRating,"G")){requestConfiguration.setMaxAdContentRating(RequestConfiguration.MAX_AD_CONTENT_RATING_G);}else{requestConfiguration.setTagForUnderAgeOfConsent(RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED);}MobileAds.setRequestConfiguration(requestConfiguration.build());}private View getView(){if(View.class.isAssignableFrom(CordovaWebView.class)){return(View)cWebView;}return cordova.getActivity().getWindow().getDecorView().findViewById(android.R.id.content);}@Override public void onPause(boolean multitasking){if(bannerView!=null){bannerView.pause();}super.onPause(multitasking);}@Override public void onResume(boolean multitasking){super.onResume(multitasking);if(bannerView!=null){bannerView.resume();}}@Override public void onDestroy(){if(bannerView!=null){bannerView.destroy();bannerView=null;}if(bannerViewLayout!=null){ViewGroup parentView=(ViewGroup)bannerViewLayout.getParent();if(parentView!=null){parentView.removeView(bannerViewLayout);}bannerViewLayout=null;}bannerAdImpression=0;super.onDestroy();}}
|
package/src/ios/emiAdmobPlugin.h
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
@property(nonatomic, strong) GADRewardedInterstitialAd* rewardedInterstitialAd;
|
10
10
|
@property(nonatomic, strong) GADRewardedAd *rewardedAd;
|
11
11
|
@property(nonatomic, readonly) BOOL isPrivacyOptionsRequired;
|
12
|
+
@property(nonatomic, strong) CDVInvokedUrlCommand *command;
|
13
|
+
@property(nonatomic, strong) GADResponseInfo *responseInfo;
|
12
14
|
- (void)initialize:(CDVInvokedUrlCommand *)command;
|
13
15
|
- (void)requestIDFA:(CDVInvokedUrlCommand *)command;
|
14
16
|
- (void)showPrivacyOptionsForm:(CDVInvokedUrlCommand *)command;
|
@@ -17,9 +19,9 @@
|
|
17
19
|
- (void)getIabTfc:(CDVInvokedUrlCommand *)command;
|
18
20
|
- (void)loadAppOpenAd:(CDVInvokedUrlCommand *)command;
|
19
21
|
- (void)showAppOpenAd:(CDVInvokedUrlCommand *)command;
|
20
|
-
- (void)
|
22
|
+
- (void)loadBannerAd:(CDVInvokedUrlCommand *)command;
|
21
23
|
- (void)showBannerAd:(CDVInvokedUrlCommand *)command;
|
22
|
-
- (void)
|
24
|
+
- (void)hideBannerAd:(CDVInvokedUrlCommand *)command;
|
23
25
|
- (void)removeBannerAd:(CDVInvokedUrlCommand *)command;
|
24
26
|
- (void)loadInterstitialAd:(CDVInvokedUrlCommand *)command;
|
25
27
|
- (void)showInterstitialAd:(CDVInvokedUrlCommand *)command;
|