@ququplay/admob 5.3.1
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/CapacitorCommunityAdmob.podspec +19 -0
- package/LICENSE +21 -0
- package/README.md +1091 -0
- package/android/build.gradle +92 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/getcapacitor/community/admob/AdMob.java +240 -0
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerAdPluginEvents.kt +11 -0
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerAdSizeEnum.kt +20 -0
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerAdSizeInfo.kt +17 -0
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerExecutor.java +294 -0
- package/android/src/main/java/com/getcapacitor/community/admob/consent/AdConsentExecutor.java +232 -0
- package/android/src/main/java/com/getcapacitor/community/admob/helpers/AdViewIdHelper.java +31 -0
- package/android/src/main/java/com/getcapacitor/community/admob/helpers/AuthorizationStatusEnum.kt +5 -0
- package/android/src/main/java/com/getcapacitor/community/admob/helpers/FullscreenPluginCallback.kt +27 -0
- package/android/src/main/java/com/getcapacitor/community/admob/helpers/RequestHelper.java +49 -0
- package/android/src/main/java/com/getcapacitor/community/admob/interstitial/AdInterstitialExecutor.java +80 -0
- package/android/src/main/java/com/getcapacitor/community/admob/interstitial/InterstitialAdCallbackAndListeners.kt +38 -0
- package/android/src/main/java/com/getcapacitor/community/admob/interstitial/InterstitialAdPluginPluginEvent.kt +11 -0
- package/android/src/main/java/com/getcapacitor/community/admob/models/AdMobPluginError.kt +15 -0
- package/android/src/main/java/com/getcapacitor/community/admob/models/AdOptions.java +225 -0
- package/android/src/main/java/com/getcapacitor/community/admob/models/Executor.java +34 -0
- package/android/src/main/java/com/getcapacitor/community/admob/models/LoadPluginEventNames.kt +7 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/AdRewardExecutor.java +80 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/RewardAdPluginEvents.kt +12 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/RewardedAdCallbackAndListeners.kt +63 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/models/SsvInfo.kt +20 -0
- package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
- package/android/src/main/res/values/colors.xml +3 -0
- package/android/src/main/res/values/strings.xml +2 -0
- package/android/src/main/res/values/styles.xml +3 -0
- package/dist/docs.json +2467 -0
- package/dist/esm/banner/banner-ad-options.interface.d.ts +25 -0
- package/dist/esm/banner/banner-ad-options.interface.js +2 -0
- package/dist/esm/banner/banner-ad-options.interface.js.map +1 -0
- package/dist/esm/banner/banner-ad-plugin-events.enum.d.ts +17 -0
- package/dist/esm/banner/banner-ad-plugin-events.enum.js +20 -0
- package/dist/esm/banner/banner-ad-plugin-events.enum.js.map +1 -0
- package/dist/esm/banner/banner-ad-position.enum.d.ts +17 -0
- package/dist/esm/banner/banner-ad-position.enum.js +19 -0
- package/dist/esm/banner/banner-ad-position.enum.js.map +1 -0
- package/dist/esm/banner/banner-ad-size.enum.d.ts +42 -0
- package/dist/esm/banner/banner-ad-size.enum.js +44 -0
- package/dist/esm/banner/banner-ad-size.enum.js.map +1 -0
- package/dist/esm/banner/banner-definitions.interface.d.ts +91 -0
- package/dist/esm/banner/banner-definitions.interface.js +2 -0
- package/dist/esm/banner/banner-definitions.interface.js.map +1 -0
- package/dist/esm/banner/banner-size.interface.d.ts +7 -0
- package/dist/esm/banner/banner-size.interface.js +2 -0
- package/dist/esm/banner/banner-size.interface.js.map +1 -0
- package/dist/esm/banner/index.d.ts +6 -0
- package/dist/esm/banner/index.js +7 -0
- package/dist/esm/banner/index.js.map +1 -0
- package/dist/esm/consent/consent-debug-geography.enum.d.ts +19 -0
- package/dist/esm/consent/consent-debug-geography.enum.js +21 -0
- package/dist/esm/consent/consent-debug-geography.enum.js.map +1 -0
- package/dist/esm/consent/consent-definition.interface.d.ts +26 -0
- package/dist/esm/consent/consent-definition.interface.js +2 -0
- package/dist/esm/consent/consent-definition.interface.js.map +1 -0
- package/dist/esm/consent/consent-info.interface.d.ts +13 -0
- package/dist/esm/consent/consent-info.interface.js +2 -0
- package/dist/esm/consent/consent-info.interface.js.map +1 -0
- package/dist/esm/consent/consent-request-options.interface.d.ts +20 -0
- package/dist/esm/consent/consent-request-options.interface.js +2 -0
- package/dist/esm/consent/consent-request-options.interface.js.map +1 -0
- package/dist/esm/consent/consent-status.enum.d.ts +23 -0
- package/dist/esm/consent/consent-status.enum.js +25 -0
- package/dist/esm/consent/consent-status.enum.js.map +1 -0
- package/dist/esm/consent/index.d.ts +5 -0
- package/dist/esm/consent/index.js +6 -0
- package/dist/esm/consent/index.js.map +1 -0
- package/dist/esm/definitions.d.ts +129 -0
- package/dist/esm/definitions.js +20 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interstitial/index.d.ts +2 -0
- package/dist/esm/interstitial/index.js +3 -0
- package/dist/esm/interstitial/index.js.map +1 -0
- package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.d.ts +22 -0
- package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.js +25 -0
- package/dist/esm/interstitial/interstitial-ad-plugin-events.enum.js.map +1 -0
- package/dist/esm/interstitial/interstitial-definitions.interface.d.ts +27 -0
- package/dist/esm/interstitial/interstitial-definitions.interface.js +2 -0
- package/dist/esm/interstitial/interstitial-definitions.interface.js.map +1 -0
- package/dist/esm/private/validate-all-events-implemented.type.d.ts +12 -0
- package/dist/esm/private/validate-all-events-implemented.type.js +2 -0
- package/dist/esm/private/validate-all-events-implemented.type.js.map +1 -0
- package/dist/esm/reward/index.d.ts +4 -0
- package/dist/esm/reward/index.js +5 -0
- package/dist/esm/reward/index.js.map +1 -0
- package/dist/esm/reward/reward-ad-options.interface.d.ts +25 -0
- package/dist/esm/reward/reward-ad-options.interface.js +2 -0
- package/dist/esm/reward/reward-ad-options.interface.js.map +1 -0
- package/dist/esm/reward/reward-ad-plugin-events.enum.d.ts +32 -0
- package/dist/esm/reward/reward-ad-plugin-events.enum.js +35 -0
- package/dist/esm/reward/reward-ad-plugin-events.enum.js.map +1 -0
- package/dist/esm/reward/reward-definitions.interface.d.ts +30 -0
- package/dist/esm/reward/reward-definitions.interface.js +2 -0
- package/dist/esm/reward/reward-definitions.interface.js.map +1 -0
- package/dist/esm/reward/reward-item.interface.d.ts +14 -0
- package/dist/esm/reward/reward-item.interface.js +2 -0
- package/dist/esm/reward/reward-item.interface.js.map +1 -0
- package/dist/esm/shared/ad-load-info.interface.d.ts +3 -0
- package/dist/esm/shared/ad-load-info.interface.js +2 -0
- package/dist/esm/shared/ad-load-info.interface.js.map +1 -0
- package/dist/esm/shared/ad-options.interface.d.ts +35 -0
- package/dist/esm/shared/ad-options.interface.js +2 -0
- package/dist/esm/shared/ad-options.interface.js.map +1 -0
- package/dist/esm/shared/admob-error.interface.d.ts +14 -0
- package/dist/esm/shared/admob-error.interface.js +2 -0
- package/dist/esm/shared/admob-error.interface.js.map +1 -0
- package/dist/esm/shared/index.d.ts +3 -0
- package/dist/esm/shared/index.js +4 -0
- package/dist/esm/shared/index.js.map +1 -0
- package/dist/esm/shared/tracking-authorization-status.interface.d.ts +6 -0
- package/dist/esm/shared/tracking-authorization-status.interface.js +2 -0
- package/dist/esm/shared/tracking-authorization-status.interface.js.map +1 -0
- package/dist/esm/web.d.ts +25 -0
- package/dist/esm/web.js +83 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +307 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +310 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/Banner/BannerAdPluginEvents.swift +8 -0
- package/ios/Plugin/Banner/BannerAdSizeEnum.swift +10 -0
- package/ios/Plugin/Banner/BannerExecutor.swift +198 -0
- package/ios/Plugin/Consent/ConsentExecutor.swift +158 -0
- package/ios/Plugin/Helper/AuthorizationStatusEnum.swift +6 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Interstitial/AdInterstitialExecutor.swift +65 -0
- package/ios/Plugin/Interstitial/InterstitialAdPluginEvents.swift +7 -0
- package/ios/Plugin/Models/FullScreenAdEventName.swift +12 -0
- package/ios/Plugin/Plugin.h +10 -0
- package/ios/Plugin/Plugin.m +23 -0
- package/ios/Plugin/Plugin.swift +275 -0
- package/ios/Plugin/Rewarded/AdRewardExecutor.swift +86 -0
- package/ios/Plugin/Rewarded/RewardAdPluginEvents.swift +8 -0
- package/package.json +108 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
4
|
+
androidxCoordinatorLayoutVersion = project.hasProperty('androidxCoordinatorLayoutVersion') ? rootProject.ext.androidxCoordinatorLayoutVersion : '1.2.0'
|
|
5
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
6
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
7
|
+
playServicesAdsVersion = project.hasProperty('playServicesAdsVersion') ? rootProject.ext.playServicesAdsVersion : '22.4.0'
|
|
8
|
+
androidxCoreKTXVersion = project.hasProperty('androidxCoreKTXVersion') ? rootProject.ext.androidxCoreKTXVersion : '1.10.0'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
buildscript {
|
|
12
|
+
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.8.20'
|
|
13
|
+
repositories {
|
|
14
|
+
google()
|
|
15
|
+
mavenCentral()
|
|
16
|
+
}
|
|
17
|
+
dependencies {
|
|
18
|
+
classpath 'com.android.tools.build:gradle:8.0.0'
|
|
19
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
apply plugin: 'com.android.library'
|
|
24
|
+
apply plugin: 'kotlin-android'
|
|
25
|
+
|
|
26
|
+
android {
|
|
27
|
+
namespace "com.getcapacitor.community.admob.admob"
|
|
28
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
29
|
+
defaultConfig {
|
|
30
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
31
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
32
|
+
versionCode 1
|
|
33
|
+
versionName "1.0"
|
|
34
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
35
|
+
}
|
|
36
|
+
buildTypes {
|
|
37
|
+
release {
|
|
38
|
+
minifyEnabled false
|
|
39
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
lintOptions {
|
|
43
|
+
abortOnError false
|
|
44
|
+
}
|
|
45
|
+
compileOptions {
|
|
46
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
47
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
48
|
+
}
|
|
49
|
+
kotlinOptions {
|
|
50
|
+
jvmTarget = JavaVersion.VERSION_17
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
repositories {
|
|
55
|
+
google()
|
|
56
|
+
mavenCentral()
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def testRunner = "1.4.0"
|
|
61
|
+
|
|
62
|
+
dependencies {
|
|
63
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
64
|
+
implementation project(':capacitor-android')
|
|
65
|
+
|
|
66
|
+
testImplementation 'org.mockito:mockito-inline:3.6.28'
|
|
67
|
+
testImplementation 'org.mockito:mockito-junit-jupiter:2.27.0'
|
|
68
|
+
testImplementation "org.junit.jupiter:junit-jupiter-api:5.3.2"
|
|
69
|
+
// https://medium.com/google-developer-experts/pushing-the-limits-of-androidx-test-3776ff249c71
|
|
70
|
+
testImplementation "androidx.test:core:$testRunner"
|
|
71
|
+
testImplementation "androidx.test:runner:$testRunner"
|
|
72
|
+
|
|
73
|
+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.3.2"
|
|
74
|
+
testImplementation "org.junit.jupiter:junit-jupiter-params:5.3.2"
|
|
75
|
+
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.3.2"
|
|
76
|
+
testImplementation 'org.json:json:20200518'
|
|
77
|
+
// We do not need expresso tests here... or?
|
|
78
|
+
// androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
79
|
+
// androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
80
|
+
|
|
81
|
+
// after 20.5.0, require minCompileSdk (31)
|
|
82
|
+
implementation "com.google.android.gms:play-services-ads:$playServicesAdsVersion"
|
|
83
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
84
|
+
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
|
85
|
+
implementation "androidx.core:core-ktx:$androidxCoreKTXVersion"
|
|
86
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Allow to run unit test with ./gradlew test
|
|
90
|
+
tasks.withType(Test) {
|
|
91
|
+
useJUnitPlatform()
|
|
92
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob;
|
|
2
|
+
|
|
3
|
+
import android.Manifest;
|
|
4
|
+
import com.getcapacitor.JSArray;
|
|
5
|
+
import com.getcapacitor.JSObject;
|
|
6
|
+
import com.getcapacitor.Plugin;
|
|
7
|
+
import com.getcapacitor.PluginCall;
|
|
8
|
+
import com.getcapacitor.PluginMethod;
|
|
9
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
10
|
+
import com.getcapacitor.annotation.Permission;
|
|
11
|
+
import com.getcapacitor.community.admob.banner.BannerExecutor;
|
|
12
|
+
import com.getcapacitor.community.admob.consent.AdConsentExecutor;
|
|
13
|
+
import com.getcapacitor.community.admob.helpers.AuthorizationStatusEnum;
|
|
14
|
+
import com.getcapacitor.community.admob.interstitial.AdInterstitialExecutor;
|
|
15
|
+
import com.getcapacitor.community.admob.interstitial.InterstitialAdCallbackAndListeners;
|
|
16
|
+
import com.getcapacitor.community.admob.rewarded.AdRewardExecutor;
|
|
17
|
+
import com.google.android.gms.ads.MobileAds;
|
|
18
|
+
import com.google.android.gms.ads.RequestConfiguration;
|
|
19
|
+
import com.google.android.gms.ads.initialization.InitializationStatus;
|
|
20
|
+
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
|
|
21
|
+
import org.json.JSONException;
|
|
22
|
+
|
|
23
|
+
@CapacitorPlugin(
|
|
24
|
+
permissions = { @Permission(alias = "network", strings = { Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.INTERNET }) }
|
|
25
|
+
)
|
|
26
|
+
public class AdMob extends Plugin {
|
|
27
|
+
|
|
28
|
+
public static final JSArray EMPTY_TESTING_DEVICES = new JSArray();
|
|
29
|
+
|
|
30
|
+
private final BannerExecutor bannerExecutor = new BannerExecutor(
|
|
31
|
+
this::getContext,
|
|
32
|
+
this::getActivity,
|
|
33
|
+
this::notifyListeners,
|
|
34
|
+
getLogTag()
|
|
35
|
+
);
|
|
36
|
+
private final AdRewardExecutor adRewardExecutor = new AdRewardExecutor(
|
|
37
|
+
this::getContext,
|
|
38
|
+
this::getActivity,
|
|
39
|
+
this::notifyListeners,
|
|
40
|
+
getLogTag()
|
|
41
|
+
);
|
|
42
|
+
private final AdInterstitialExecutor adInterstitialExecutor = new AdInterstitialExecutor(
|
|
43
|
+
this::getContext,
|
|
44
|
+
this::getActivity,
|
|
45
|
+
this::notifyListeners,
|
|
46
|
+
getLogTag(),
|
|
47
|
+
InterstitialAdCallbackAndListeners.INSTANCE
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
private final AdConsentExecutor adConsentExecutor = new AdConsentExecutor(
|
|
51
|
+
this::getContext,
|
|
52
|
+
this::getActivity,
|
|
53
|
+
this::notifyListeners,
|
|
54
|
+
getLogTag()
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// Initialize AdMob with appId
|
|
58
|
+
@PluginMethod
|
|
59
|
+
public void initialize(final PluginCall call) {
|
|
60
|
+
this.setRequestConfiguration(call);
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
MobileAds.initialize(
|
|
64
|
+
getContext(),
|
|
65
|
+
new OnInitializationCompleteListener() {
|
|
66
|
+
@Override
|
|
67
|
+
public void onInitializationComplete(InitializationStatus initializationStatus) {}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
bannerExecutor.initialize();
|
|
71
|
+
call.resolve();
|
|
72
|
+
} catch (Exception ex) {
|
|
73
|
+
call.reject(ex.getLocalizedMessage(), ex);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@PluginMethod
|
|
78
|
+
public void requestTrackingAuthorization(final PluginCall call) {
|
|
79
|
+
call.resolve();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@PluginMethod
|
|
83
|
+
public void trackingAuthorizationStatus(final PluginCall call) {
|
|
84
|
+
JSObject response = new JSObject();
|
|
85
|
+
response.put("status", AuthorizationStatusEnum.AUTHORIZED.getStatus());
|
|
86
|
+
call.resolve(response);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// User Consent
|
|
90
|
+
@PluginMethod
|
|
91
|
+
public void requestConsentInfo(final PluginCall call) {
|
|
92
|
+
adConsentExecutor.requestConsentInfo(call, this::notifyListeners);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@PluginMethod
|
|
96
|
+
public void showConsentForm(final PluginCall call) {
|
|
97
|
+
adConsentExecutor.showConsentForm(call, this::notifyListeners);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@PluginMethod
|
|
101
|
+
public void resetConsentInfo(final PluginCall call) {
|
|
102
|
+
adConsentExecutor.resetConsentInfo(call, this::notifyListeners);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@PluginMethod
|
|
106
|
+
public void setApplicationMuted(final PluginCall call) {
|
|
107
|
+
Boolean muted = call.getBoolean("muted");
|
|
108
|
+
if (muted == null) {
|
|
109
|
+
call.reject("muted property cannot be null");
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
MobileAds.setAppMuted(muted);
|
|
113
|
+
call.resolve();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@PluginMethod
|
|
117
|
+
public void setApplicationVolume(final PluginCall call) {
|
|
118
|
+
Float volume = call.getFloat("volume");
|
|
119
|
+
if (volume == null) {
|
|
120
|
+
call.reject("volume property cannot be null");
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
MobileAds.setAppVolume(volume);
|
|
124
|
+
call.resolve();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Show a banner Ad
|
|
128
|
+
@PluginMethod
|
|
129
|
+
public void showBanner(final PluginCall call) {
|
|
130
|
+
bannerExecutor.showBanner(call);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Hide the banner, remove it from screen, but can show it later
|
|
134
|
+
@PluginMethod
|
|
135
|
+
public void hideBanner(final PluginCall call) {
|
|
136
|
+
bannerExecutor.hideBanner(call);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Resume the banner, show it after hide
|
|
140
|
+
@PluginMethod
|
|
141
|
+
public void resumeBanner(final PluginCall call) {
|
|
142
|
+
bannerExecutor.resumeBanner(call);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Destroy the banner, remove it from screen.
|
|
146
|
+
@PluginMethod
|
|
147
|
+
public void removeBanner(final PluginCall call) {
|
|
148
|
+
bannerExecutor.removeBanner(call);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@PluginMethod
|
|
152
|
+
public void prepareInterstitial(final PluginCall call) {
|
|
153
|
+
adInterstitialExecutor.prepareInterstitial(call, this::notifyListeners);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Show interstitial Ad
|
|
157
|
+
@PluginMethod
|
|
158
|
+
public void showInterstitial(final PluginCall call) {
|
|
159
|
+
adInterstitialExecutor.showInterstitial(call, this::notifyListeners);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@PluginMethod
|
|
163
|
+
public void prepareRewardVideoAd(final PluginCall call) {
|
|
164
|
+
adRewardExecutor.prepareRewardVideoAd(call, this::notifyListeners);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@PluginMethod
|
|
168
|
+
public void showRewardVideoAd(final PluginCall call) {
|
|
169
|
+
adRewardExecutor.showRewardVideoAd(call, this::notifyListeners);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @see <a href="https://developers.google.com/admob/android/test-ads#enable_test_devices">Test Devices</a>
|
|
174
|
+
* @see <a href="https://developers.google.com/admob/android/targeting">Target Settings</a>
|
|
175
|
+
*/
|
|
176
|
+
private void setRequestConfiguration(final PluginCall call) {
|
|
177
|
+
// Testing Devices
|
|
178
|
+
final boolean initializeForTesting = call.getBoolean("initializeForTesting", false);
|
|
179
|
+
final JSArray testingDevices = initializeForTesting
|
|
180
|
+
? call.getArray("testingDevices", AdMob.EMPTY_TESTING_DEVICES)
|
|
181
|
+
: EMPTY_TESTING_DEVICES;
|
|
182
|
+
|
|
183
|
+
// tagForChildDirectedTreatment
|
|
184
|
+
final Boolean tagForChildDirectedTreatment = call.getBoolean("tagForChildDirectedTreatment");
|
|
185
|
+
int TAG_FOR_CHILD_DIRECTED_TREATMENT;
|
|
186
|
+
|
|
187
|
+
if (tagForChildDirectedTreatment == null) {
|
|
188
|
+
TAG_FOR_CHILD_DIRECTED_TREATMENT = RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED;
|
|
189
|
+
} else if (tagForChildDirectedTreatment) {
|
|
190
|
+
TAG_FOR_CHILD_DIRECTED_TREATMENT = RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE;
|
|
191
|
+
} else {
|
|
192
|
+
TAG_FOR_CHILD_DIRECTED_TREATMENT = RequestConfiguration.TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// tagForUnderAgeOfConsent
|
|
196
|
+
final Boolean tagForUnderAgeOfConsent = call.getBoolean("tagForUnderAgeOfConsent");
|
|
197
|
+
int TAG_FOR_UNDER_AGE_OF_CONSENT;
|
|
198
|
+
|
|
199
|
+
if (tagForUnderAgeOfConsent == null) {
|
|
200
|
+
TAG_FOR_UNDER_AGE_OF_CONSENT = RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED;
|
|
201
|
+
} else if (tagForUnderAgeOfConsent) {
|
|
202
|
+
TAG_FOR_UNDER_AGE_OF_CONSENT = RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE;
|
|
203
|
+
} else {
|
|
204
|
+
TAG_FOR_UNDER_AGE_OF_CONSENT = RequestConfiguration.TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// maxAdContentRating
|
|
208
|
+
final String maxAdContentRating = call.getString("maxAdContentRating");
|
|
209
|
+
String MAX_AD_CONTENT_RATING = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
|
|
210
|
+
|
|
211
|
+
if (maxAdContentRating != null) {
|
|
212
|
+
switch (maxAdContentRating) {
|
|
213
|
+
case "General":
|
|
214
|
+
MAX_AD_CONTENT_RATING = RequestConfiguration.MAX_AD_CONTENT_RATING_G;
|
|
215
|
+
break;
|
|
216
|
+
case "ParentalGuidance":
|
|
217
|
+
MAX_AD_CONTENT_RATING = RequestConfiguration.MAX_AD_CONTENT_RATING_PG;
|
|
218
|
+
break;
|
|
219
|
+
case "Teen":
|
|
220
|
+
MAX_AD_CONTENT_RATING = RequestConfiguration.MAX_AD_CONTENT_RATING_T;
|
|
221
|
+
break;
|
|
222
|
+
case "MatureAudience":
|
|
223
|
+
MAX_AD_CONTENT_RATING = RequestConfiguration.MAX_AD_CONTENT_RATING_MA;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
try {
|
|
229
|
+
RequestConfiguration requestConfiguration = new RequestConfiguration.Builder()
|
|
230
|
+
.setTestDeviceIds(testingDevices.<String>toList())
|
|
231
|
+
.setTagForChildDirectedTreatment(TAG_FOR_CHILD_DIRECTED_TREATMENT)
|
|
232
|
+
.setTagForUnderAgeOfConsent(TAG_FOR_UNDER_AGE_OF_CONSENT)
|
|
233
|
+
.setMaxAdContentRating(MAX_AD_CONTENT_RATING)
|
|
234
|
+
.build();
|
|
235
|
+
MobileAds.setRequestConfiguration(requestConfiguration);
|
|
236
|
+
} catch (JSONException error) {
|
|
237
|
+
call.reject(error.toString());
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.banner
|
|
2
|
+
|
|
3
|
+
enum class BannerAdPluginEvents(val webEventName: String) {
|
|
4
|
+
SizeChanged("bannerAdSizeChanged"),
|
|
5
|
+
Closed("bannerAdClosed"),
|
|
6
|
+
FailedToLoad("bannerAdFailedToLoad"),
|
|
7
|
+
Opened("bannerAdOpened"),
|
|
8
|
+
Loaded("bannerAdLoaded"),
|
|
9
|
+
Clicked("bannerAdClicked"),
|
|
10
|
+
AdImpression("bannerAdImpression"),
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.banner
|
|
2
|
+
|
|
3
|
+
import com.google.android.gms.ads.AdSize
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* https://developers.google.com/admob/android/banner#banner_sizes
|
|
7
|
+
*/
|
|
8
|
+
enum class BannerAdSizeEnum(val size: AdSize) {
|
|
9
|
+
BANNER(AdSize.BANNER),
|
|
10
|
+
FULL_BANNER(AdSize.FULL_BANNER),
|
|
11
|
+
LARGE_BANNER(AdSize.LARGE_BANNER),
|
|
12
|
+
MEDIUM_RECTANGLE(AdSize.MEDIUM_RECTANGLE),
|
|
13
|
+
LEADERBOARD(AdSize.LEADERBOARD),
|
|
14
|
+
ADAPTIVE_BANNER(AdSize.INVALID), // We should not use the AdSize here but calculate the device size
|
|
15
|
+
SMART_BANNER(AdSize.SMART_BANNER);
|
|
16
|
+
|
|
17
|
+
override fun toString(): String {
|
|
18
|
+
return name
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.banner
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.JSObject
|
|
4
|
+
import com.google.android.gms.ads.AdError
|
|
5
|
+
import com.google.android.gms.ads.AdView
|
|
6
|
+
import java.util.*
|
|
7
|
+
|
|
8
|
+
data class BannerAdSizeInfo(val width: Int, val height: Int) : JSObject() {
|
|
9
|
+
override fun put(key: String, value: Int): JSObject {
|
|
10
|
+
throw Exception("Do not put elements directly here use the constructor")
|
|
11
|
+
}
|
|
12
|
+
init {
|
|
13
|
+
super.put("width", width)
|
|
14
|
+
super.put("height", height)
|
|
15
|
+
}
|
|
16
|
+
constructor(mAdView: AdView): this(Objects.requireNonNull(mAdView.adSize)!!.width, Objects.requireNonNull(mAdView.adSize)!!.height)
|
|
17
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.banner;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.util.DisplayMetrics;
|
|
6
|
+
import android.util.Log;
|
|
7
|
+
import android.view.Gravity;
|
|
8
|
+
import android.view.View;
|
|
9
|
+
import android.view.ViewGroup;
|
|
10
|
+
import android.view.WindowManager;
|
|
11
|
+
import android.widget.RelativeLayout;
|
|
12
|
+
import androidx.annotation.NonNull;
|
|
13
|
+
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
14
|
+
import androidx.core.util.Supplier;
|
|
15
|
+
import com.getcapacitor.JSObject;
|
|
16
|
+
import com.getcapacitor.PluginCall;
|
|
17
|
+
import com.getcapacitor.community.admob.helpers.AdViewIdHelper;
|
|
18
|
+
import com.getcapacitor.community.admob.helpers.RequestHelper;
|
|
19
|
+
import com.getcapacitor.community.admob.models.AdMobPluginError;
|
|
20
|
+
import com.getcapacitor.community.admob.models.AdOptions;
|
|
21
|
+
import com.getcapacitor.community.admob.models.Executor;
|
|
22
|
+
import com.google.android.gms.ads.AdListener;
|
|
23
|
+
import com.google.android.gms.ads.AdRequest;
|
|
24
|
+
import com.google.android.gms.ads.AdSize;
|
|
25
|
+
import com.google.android.gms.ads.AdView;
|
|
26
|
+
import com.google.android.gms.ads.LoadAdError;
|
|
27
|
+
import com.google.android.gms.common.util.BiConsumer;
|
|
28
|
+
|
|
29
|
+
public class BannerExecutor extends Executor {
|
|
30
|
+
|
|
31
|
+
private final JSObject emptyObject = new JSObject();
|
|
32
|
+
private RelativeLayout mAdViewLayout;
|
|
33
|
+
private AdView mAdView;
|
|
34
|
+
private ViewGroup mViewGroup;
|
|
35
|
+
|
|
36
|
+
public BannerExecutor(
|
|
37
|
+
Supplier<Context> contextSupplier,
|
|
38
|
+
Supplier<Activity> activitySupplier,
|
|
39
|
+
BiConsumer<String, JSObject> notifyListenersFunction,
|
|
40
|
+
String pluginLogTag
|
|
41
|
+
) {
|
|
42
|
+
super(contextSupplier, activitySupplier, notifyListenersFunction, pluginLogTag, "BannerExecutor");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public void initialize() {
|
|
46
|
+
mViewGroup = (ViewGroup) ((ViewGroup) activitySupplier.get().findViewById(android.R.id.content)).getChildAt(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public void showBanner(final PluginCall call) {
|
|
50
|
+
final AdOptions adOptions = AdOptions.getFactory().createBannerOptions(call);
|
|
51
|
+
float density = contextSupplier.get().getResources().getDisplayMetrics().density;
|
|
52
|
+
|
|
53
|
+
int defaultWidthPixels = contextSupplier.get().getResources().getDisplayMetrics().widthPixels;
|
|
54
|
+
|
|
55
|
+
DisplayMetrics metrics = new DisplayMetrics();
|
|
56
|
+
activitySupplier.get().getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
|
|
57
|
+
int realWidthPixels = metrics.widthPixels;
|
|
58
|
+
|
|
59
|
+
boolean fullscreen = false;
|
|
60
|
+
if ((activitySupplier.get().getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0) {
|
|
61
|
+
fullscreen = true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (mAdView != null) {
|
|
65
|
+
updateExistingAdView(adOptions);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Why a try catch block?
|
|
70
|
+
try {
|
|
71
|
+
mAdView = new AdView(contextSupplier.get());
|
|
72
|
+
|
|
73
|
+
if (!adOptions.adSize.toString().equals("ADAPTIVE_BANNER")) {
|
|
74
|
+
mAdView.setAdSize(adOptions.adSize.getSize());
|
|
75
|
+
} else {
|
|
76
|
+
// ADAPTIVE BANNER
|
|
77
|
+
mAdView.setAdSize(
|
|
78
|
+
AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(contextSupplier.get(), (int) (defaultWidthPixels / density))
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Setup AdView Layout
|
|
83
|
+
mAdViewLayout = new RelativeLayout(contextSupplier.get());
|
|
84
|
+
mAdViewLayout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL);
|
|
85
|
+
mAdViewLayout.setVerticalGravity(Gravity.BOTTOM);
|
|
86
|
+
|
|
87
|
+
final CoordinatorLayout.LayoutParams mAdViewLayoutParams = new CoordinatorLayout.LayoutParams(
|
|
88
|
+
CoordinatorLayout.LayoutParams.WRAP_CONTENT,
|
|
89
|
+
CoordinatorLayout.LayoutParams.WRAP_CONTENT
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// TODO: Make an enum like the AdSizeEnum?
|
|
93
|
+
switch (adOptions.position) {
|
|
94
|
+
case "TOP_CENTER":
|
|
95
|
+
mAdViewLayoutParams.gravity = Gravity.TOP;
|
|
96
|
+
break;
|
|
97
|
+
case "CENTER":
|
|
98
|
+
mAdViewLayoutParams.gravity = Gravity.CENTER;
|
|
99
|
+
break;
|
|
100
|
+
default:
|
|
101
|
+
mAdViewLayoutParams.gravity = Gravity.BOTTOM;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
mAdViewLayout.setLayoutParams(mAdViewLayoutParams);
|
|
106
|
+
|
|
107
|
+
int densityMargin = (int) (adOptions.margin * density);
|
|
108
|
+
|
|
109
|
+
// Center Banner Ads
|
|
110
|
+
int adWidth = (int) (adOptions.adSize.getSize().getWidth() * density);
|
|
111
|
+
|
|
112
|
+
if (adWidth <= 0 || adOptions.adSize.toString().equals("ADAPTIVE_BANNER")) {
|
|
113
|
+
int margin = 0;
|
|
114
|
+
if (fullscreen) {
|
|
115
|
+
margin = (realWidthPixels - defaultWidthPixels) / 2;
|
|
116
|
+
}
|
|
117
|
+
mAdViewLayoutParams.setMargins(margin, densityMargin, margin, densityMargin);
|
|
118
|
+
} else {
|
|
119
|
+
int sideMargin = ((int) defaultWidthPixels - adWidth) / 2;
|
|
120
|
+
if (fullscreen) {
|
|
121
|
+
sideMargin = (realWidthPixels - adWidth) / 2;
|
|
122
|
+
}
|
|
123
|
+
mAdViewLayoutParams.setMargins(sideMargin, densityMargin, sideMargin, densityMargin);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
createNewAdView(adOptions);
|
|
127
|
+
|
|
128
|
+
call.resolve();
|
|
129
|
+
} catch (Exception ex) {
|
|
130
|
+
call.reject(ex.getLocalizedMessage(), ex);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public void hideBanner(final PluginCall call) {
|
|
135
|
+
if (mAdView == null) {
|
|
136
|
+
call.reject("You tried to hide a banner that was never shown");
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
activitySupplier
|
|
142
|
+
.get()
|
|
143
|
+
.runOnUiThread(
|
|
144
|
+
() -> {
|
|
145
|
+
if (mAdViewLayout != null) {
|
|
146
|
+
mAdViewLayout.setVisibility(View.GONE);
|
|
147
|
+
mAdView.pause();
|
|
148
|
+
|
|
149
|
+
final BannerAdSizeInfo sizeInfo = new BannerAdSizeInfo(0, 0);
|
|
150
|
+
|
|
151
|
+
notifyListeners(BannerAdPluginEvents.SizeChanged.getWebEventName(), sizeInfo);
|
|
152
|
+
|
|
153
|
+
call.resolve();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
} catch (Exception ex) {
|
|
158
|
+
call.reject(ex.getLocalizedMessage(), ex);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public void resumeBanner(final PluginCall call) {
|
|
163
|
+
try {
|
|
164
|
+
activitySupplier
|
|
165
|
+
.get()
|
|
166
|
+
.runOnUiThread(
|
|
167
|
+
() -> {
|
|
168
|
+
if (mAdViewLayout != null && mAdView != null) {
|
|
169
|
+
mAdViewLayout.setVisibility(View.VISIBLE);
|
|
170
|
+
mAdView.resume();
|
|
171
|
+
|
|
172
|
+
final BannerAdSizeInfo sizeInfo = new BannerAdSizeInfo(mAdView);
|
|
173
|
+
notifyListeners(BannerAdPluginEvents.SizeChanged.getWebEventName(), sizeInfo);
|
|
174
|
+
|
|
175
|
+
Log.d(logTag, "Banner AD Resumed");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
call.resolve();
|
|
181
|
+
} catch (Exception ex) {
|
|
182
|
+
call.reject(ex.getLocalizedMessage(), ex);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
public void removeBanner(final PluginCall call) {
|
|
187
|
+
try {
|
|
188
|
+
if (mAdView != null) {
|
|
189
|
+
activitySupplier
|
|
190
|
+
.get()
|
|
191
|
+
.runOnUiThread(
|
|
192
|
+
() -> {
|
|
193
|
+
if (mAdView != null) {
|
|
194
|
+
mViewGroup.removeView(mAdViewLayout);
|
|
195
|
+
mAdViewLayout.removeView(mAdView);
|
|
196
|
+
mAdView.destroy();
|
|
197
|
+
mAdView = null;
|
|
198
|
+
Log.d(logTag, "Banner AD Removed");
|
|
199
|
+
final BannerAdSizeInfo sizeInfo = new BannerAdSizeInfo(0, 0);
|
|
200
|
+
notifyListeners(BannerAdPluginEvents.SizeChanged.getWebEventName(), sizeInfo);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
call.resolve();
|
|
207
|
+
} catch (Exception ex) {
|
|
208
|
+
call.reject(ex.getLocalizedMessage(), ex);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
private void updateExistingAdView(AdOptions adOptions) {
|
|
213
|
+
activitySupplier
|
|
214
|
+
.get()
|
|
215
|
+
.runOnUiThread(
|
|
216
|
+
() -> {
|
|
217
|
+
final AdRequest adRequest = RequestHelper.createRequest(adOptions);
|
|
218
|
+
mAdView.loadAd(adRequest);
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Follow iOS method Name:
|
|
225
|
+
* https://developers.google.com/admob/ios/banner?hl=ja
|
|
226
|
+
*/
|
|
227
|
+
private void createNewAdView(AdOptions adOptions) {
|
|
228
|
+
// Run AdMob In Main UI Thread
|
|
229
|
+
activitySupplier
|
|
230
|
+
.get()
|
|
231
|
+
.runOnUiThread(
|
|
232
|
+
() -> {
|
|
233
|
+
final AdRequest adRequest = RequestHelper.createRequest(adOptions);
|
|
234
|
+
// Assign the correct id needed
|
|
235
|
+
AdViewIdHelper.assignIdToAdView(mAdView, adOptions, adRequest, logTag, contextSupplier.get());
|
|
236
|
+
// Add the AdView to the view hierarchy.
|
|
237
|
+
mAdViewLayout.addView(mAdView);
|
|
238
|
+
// Start loading the ad.
|
|
239
|
+
mAdView.loadAd(adRequest);
|
|
240
|
+
mAdView.setAdListener(
|
|
241
|
+
new AdListener() {
|
|
242
|
+
@Override
|
|
243
|
+
public void onAdLoaded() {
|
|
244
|
+
final BannerAdSizeInfo sizeInfo = new BannerAdSizeInfo(mAdView);
|
|
245
|
+
|
|
246
|
+
notifyListeners(BannerAdPluginEvents.SizeChanged.getWebEventName(), sizeInfo);
|
|
247
|
+
notifyListeners(BannerAdPluginEvents.Loaded.getWebEventName(), emptyObject);
|
|
248
|
+
super.onAdLoaded();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@Override
|
|
252
|
+
public void onAdFailedToLoad(@NonNull LoadAdError adError) {
|
|
253
|
+
if (mAdView != null) {
|
|
254
|
+
mViewGroup.removeView(mAdViewLayout);
|
|
255
|
+
mAdViewLayout.removeView(mAdView);
|
|
256
|
+
mAdView.destroy();
|
|
257
|
+
mAdView = null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
final BannerAdSizeInfo sizeInfo = new BannerAdSizeInfo(0, 0);
|
|
261
|
+
notifyListeners(BannerAdPluginEvents.SizeChanged.getWebEventName(), sizeInfo);
|
|
262
|
+
|
|
263
|
+
final AdMobPluginError adMobPluginError = new AdMobPluginError(adError);
|
|
264
|
+
notifyListeners(BannerAdPluginEvents.FailedToLoad.getWebEventName(), adMobPluginError);
|
|
265
|
+
|
|
266
|
+
super.onAdFailedToLoad(adError);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@Override
|
|
270
|
+
public void onAdOpened() {
|
|
271
|
+
notifyListeners(BannerAdPluginEvents.Opened.getWebEventName(), emptyObject);
|
|
272
|
+
super.onAdOpened();
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
@Override
|
|
276
|
+
public void onAdClosed() {
|
|
277
|
+
notifyListeners(BannerAdPluginEvents.Closed.getWebEventName(), emptyObject);
|
|
278
|
+
super.onAdClosed();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
@Override
|
|
282
|
+
public void onAdImpression() {
|
|
283
|
+
notifyListeners(BannerAdPluginEvents.AdImpression.getWebEventName(), emptyObject);
|
|
284
|
+
super.onAdImpression();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
// Add AdViewLayout top of the WebView
|
|
290
|
+
mViewGroup.addView(mAdViewLayout);
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
}
|