emi-indo-cordova-plugin-admob 1.5.3 → 1.5.5

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.
@@ -0,0 +1,156 @@
1
+ // cordova.plugins.emiAdmobPlugin.styleBannerAd({ padding: 50, margins: 50 }); // (Optional only android)
2
+ //cordova.plugins.emiAdmobPlugin.loadBannerAd({config});
3
+ //cordova.plugins.emiAdmobPlugin.showBannerAd(); // default
4
+ //cordova.plugins.emiAdmobPlugin.hideBannerAd(); // default
5
+ //cordova.plugins.emiAdmobPlugin.removeBannerAd(); // default
6
+
7
+
8
+
9
+ function loadBanner() {
10
+
11
+ if (typeof cordova !== 'undefined') {
12
+
13
+ cordova.plugins.emiAdmobPlugin.loadBannerAd({
14
+ adUnitId: Banner_ID, //Banner_ID,
15
+ position: "bottom-center",
16
+ size: "responsive_adaptive", // autoResize: true (only responsive_adaptive)
17
+ collapsible: "bottom", // position: top | bottom (disable, empty string)
18
+ autoResize: true, // default false
19
+ autoShow: true, // default false
20
+
21
+ });
22
+ }
23
+
24
+ }
25
+
26
+
27
+
28
+
29
+
30
+
31
+ /* ///////<<<< bannerAd position >>>>>>\\\\\\\
32
+
33
+ (ANDROID)
34
+
35
+ top-right
36
+ top-center
37
+ left
38
+ center
39
+ right
40
+ bottom-center
41
+ bottom-right
42
+
43
+ (IOS)
44
+
45
+ bottom-center
46
+ top-center
47
+
48
+ */
49
+
50
+ /* ///////<<<< bannerAd size >>>>>>\\\\\\\
51
+
52
+ (ANDROID)
53
+
54
+ responsive_adaptive
55
+ anchored_adaptive
56
+ full_width_adaptive
57
+ in_line_adaptive
58
+ banner
59
+ large_banner
60
+ medium_rectangle
61
+ full_banner
62
+ leaderboard
63
+ fluid
64
+
65
+ (IOS)
66
+
67
+ responsive_adaptive
68
+ in_line_adaptive
69
+ banner
70
+ large_banner
71
+ full_banner
72
+ leaderboard
73
+
74
+
75
+
76
+ */
77
+
78
+
79
+
80
+
81
+ /* ///////<<<< bannerAd event >>>>>>\\\\\\\
82
+
83
+ on.banner.load
84
+ on.banner.failed.load
85
+ on.banner.click
86
+ on.banner.close
87
+ on.banner.impression
88
+ on.banner.open
89
+
90
+ on.banner.revenue
91
+ on.banner.remove
92
+ on.banner.hide
93
+
94
+ // New event plugin v1.5.5 or higher
95
+
96
+ on.is.collapsible
97
+ on.bannerAd.responseInfo
98
+
99
+ */
100
+
101
+
102
+
103
+
104
+ // EVENT For example
105
+
106
+ document.addEventListener('on.banner.load', () => {
107
+ console.log("on banner load");
108
+ });
109
+
110
+
111
+ document.addEventListener('on.is.collapsible', function (event) {
112
+ // bannerConfig collapsible: "bottom", // position: top | bottom (disable, empty string)
113
+ console.log("Collapsible Status: " + event.collapsible);
114
+
115
+
116
+ });
117
+
118
+ document.addEventListener('on.banner.failed.load', (error) => {
119
+ console.log("on.banner.failed.load" + JSON.stringify(error));
120
+ });
121
+
122
+
123
+
124
+ /*
125
+ // DEBUG
126
+ // isResponseInfo: true, // debug Default false
127
+ document.addEventListener('on.bannerAd.responseInfo', (data) => {
128
+ console.log("on.bannerAd.responseInfo" + JSON.stringify(data));
129
+ if (window.log) window.log.value += ("\n on.bannerAd.responseInfo" + JSON.stringify(data));
130
+ });
131
+
132
+ */
133
+
134
+
135
+
136
+
137
+ /*
138
+ https://support.google.com/admob/answer/11322405
139
+
140
+ Turn on the setting for impression-level ad revenue in your AdMob account:
141
+ Sign in to your AdMob account at https://apps.admob.com.
142
+ Click Settings in the sidebar.
143
+ Click the Account tab.
144
+ In the Account controls section, click the Impression-level ad revenue toggle to turn on this setting.
145
+ */
146
+
147
+ document.addEventListener('on.banner.revenue', (data) => {
148
+
149
+ console.log(data.value)
150
+ console.log(data.currencyCode)
151
+ console.log(data.precision)
152
+ console.log(data.adUnitId)
153
+
154
+ //console.log("on.banner.revenue" + JSON.stringify(data));
155
+ if (window.log) window.log.value += ("\n on.banner.revenue" + JSON.stringify(data));
156
+ });
@@ -0,0 +1,110 @@
1
+
2
+ window.log = document.getElementById('log');
3
+
4
+ var App_Open_ID;
5
+ var Banner_ID;
6
+ var Interstitial_ID;
7
+ var Rewarded_ID;
8
+ var Rewarded_Interstitial_ID;
9
+
10
+ // Ad format Demo ad unit ID
11
+ // https://developers.google.com/admob/android/test-ads
12
+ // https://developers.google.com/admob/ios/test-ads
13
+
14
+
15
+ /* https://support.google.com/admob/answer/9493252?hl=en
16
+ Best practice when using ad original ID unit,
17
+ the app must be uploaded to the play store or app store,
18
+ and you must upload it from there,
19
+ otherwise you may be subject to ad serving restrictions,
20
+ if it happens often, it is possible that your admob account will be permanently disabled.
21
+ */
22
+
23
+
24
+ if (window.cordova.platformId === 'ios') {
25
+
26
+ App_Open_ID = 'ca-app-pub-3940256099942544/5575463023';
27
+ Banner_ID = 'ca-app-pub-3940256099942544/2934735716';
28
+ Interstitial_ID = 'ca-app-pub-3940256099942544/4411468910';
29
+ Rewarded_ID = 'ca-app-pub-3940256099942544/1712485313';
30
+ Rewarded_Interstitial_ID = 'ca-app-pub-3940256099942544/6978759866';
31
+
32
+ } else {
33
+ // Assume Android
34
+ App_Open_ID = 'ca-app-pub-3940256099942544/9257395921';
35
+ Banner_ID = 'ca-app-pub-3940256099942544/9214589741';
36
+ Interstitial_ID = 'ca-app-pub-3940256099942544/1033173712';
37
+ Rewarded_ID = 'ca-app-pub-3940256099942544/5224354917';
38
+ Rewarded_Interstitial_ID = 'ca-app-pub-3940256099942544/5354046379';
39
+ }
40
+
41
+
42
+
43
+
44
+ function cleanText(){
45
+
46
+ window.log.value = "";
47
+
48
+ }
49
+
50
+
51
+
52
+ //////////////////////
53
+ // cordova deviceready
54
+ /////////////////////
55
+ document.addEventListener("deviceready", function () {
56
+
57
+
58
+ // targeting
59
+ cordova.plugins.emiAdmobPlugin.targeting({
60
+ childDirectedTreatment: false, // default: false
61
+ underAgeOfConsent: false, // default: false
62
+ contentRating: "MA", // value: G | MA | PG | T | ""
63
+ });
64
+
65
+
66
+
67
+ // globalSettings
68
+ cordova.plugins.emiAdmobPlugin.globalSettings({
69
+ setAppMuted: false, // Type Boolean default: false
70
+ setAppVolume: 1.0, // Type float
71
+ pubIdEnabled: false, // default: false
72
+ });
73
+
74
+
75
+
76
+
77
+
78
+ // AdMob Sdk initialize
79
+
80
+ cordova.plugins.emiAdmobPlugin.initialize({
81
+
82
+ isUsingAdManagerRequest: true, // AdManagerAdRequest.Builder | AdRequest.Builder (Default true)
83
+ isResponseInfo: true, // debug Default false
84
+ isConsentDebug: true, // debug Default false
85
+
86
+ });
87
+
88
+
89
+ // SDK EVENT Initialization
90
+ // Optional
91
+ document.addEventListener('on.sdkInitialization', (data) => {
92
+ // JSON.stringify(data)
93
+ const sdkVersion = data.version;
94
+ // const adAdapter = data.adapters;
95
+ const conStatus = data.consentStatus;
96
+ // const gdprApplie = data.gdprApplies;
97
+ // const purposeConsent = data.purposeConsents;
98
+ // const vendorConsents = data.vendorConsents;
99
+ // const conTCString = data.consentTCString;
100
+ // const additionalConsent = data.additionalConsent;
101
+ log.value += ("\n On Sdk Initialization version: " + sdkVersion);
102
+ log.value += ("\n On Consent Status: " + conStatus);
103
+
104
+ loadBanner(); // auto show
105
+
106
+ });
107
+
108
+
109
+
110
+ }, false);
@@ -0,0 +1,123 @@
1
+
2
+
3
+
4
+ let isInterstitialLoad = false;
5
+
6
+ function loadInterstitial() {
7
+
8
+ if (typeof cordova !== 'undefined') {
9
+
10
+ cordova.plugins.emiAdmobPlugin.loadInterstitialAd({ adUnitId: Interstitial_ID, autoShow: false });
11
+
12
+ }
13
+ }
14
+
15
+ function showInterstitial() {
16
+
17
+ if (typeof cordova !== 'undefined') {
18
+
19
+ if (isInterstitialLoad) {
20
+ cordova.plugins.emiAdmobPlugin.showInterstitialAd();
21
+ }
22
+ }
23
+
24
+ }
25
+
26
+ /*
27
+
28
+ on.interstitial.loaded
29
+ on.interstitial.failed.load
30
+ on.interstitial.click
31
+ on.interstitial.dismissed
32
+ on.interstitial.failed.show
33
+ on.interstitial.impression
34
+ on.interstitial.show
35
+
36
+ // New event plugin v1.5.5 or higher
37
+
38
+ on.interstitial.revenue
39
+ on.interstitialAd.responseInfo
40
+
41
+ */
42
+
43
+
44
+
45
+ // EVENT For example
46
+
47
+ document.addEventListener('on.interstitial.loaded', () => {
48
+ isInterstitialLoad = true;
49
+ console.log("on interstitial Ad loaded");
50
+
51
+ window.log.value += ("\n on interstitial Ad loaded");
52
+ });
53
+
54
+
55
+ // all events that contain the keyword dismissed there is a block to load the ad after it is closed by the user.
56
+ document.addEventListener('on.interstitial.dismissed', () => {
57
+ isInterstitialLoad = false;
58
+ console.log("on interstitial Ad dismissed");
59
+ console.log("you can load ads automatically after the ads are closed by users");
60
+
61
+ loadInterstitial();
62
+
63
+ window.log.value += ("\n you can load ads automatically after the ads are closed by users");
64
+
65
+ });
66
+
67
+
68
+ document.addEventListener('on.interstitial.failed.load', (error) => {
69
+ isInterstitialLoad = false;
70
+ console.log("on.interstitial.failed.load" + JSON.stringify(error));
71
+
72
+ window.log.value += ("\n on.interstitial.failed.load" + JSON.stringify(error));
73
+ });
74
+
75
+
76
+ document.addEventListener('on.interstitial.failed.show', (error) => {
77
+ isInterstitialLoad = false;
78
+ console.log("on.interstitial.failed.show" + JSON.stringify(error));
79
+
80
+ window.log.value += ("\n on.interstitial.failed.show" + JSON.stringify(error));
81
+ });
82
+
83
+
84
+ /*
85
+ // DEBUG
86
+ // isResponseInfo: true, // debug Default false
87
+ document.addEventListener('on.interstitialAd.responseInfo', (data) => {
88
+
89
+ console.log("on.interstitialAd.responseInfo" + JSON.stringify(data));
90
+ if (window.log) window.log.value += ("\n on.interstitialAd.responseInfo" + JSON.stringify(data));
91
+ });
92
+
93
+ */
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ /*
102
+ https://support.google.com/admob/answer/11322405
103
+
104
+ Turn on the setting for impression-level ad revenue in your AdMob account:
105
+ Sign in to your AdMob account at https://apps.admob.com.
106
+ Click Settings in the sidebar.
107
+ Click the Account tab.
108
+ In the Account controls section, click the Impression-level ad revenue toggle to turn on this setting.
109
+ */
110
+
111
+ document.addEventListener('on.interstitial.revenue', (data) => {
112
+
113
+ console.log(data.value)
114
+ console.log(data.currencyCode)
115
+ console.log(data.precision)
116
+ console.log(data.adUnitId)
117
+
118
+ // console.log("on.interstitial.revenue" + JSON.stringify(data));
119
+ if (window.log) window.log.value += ("\n on.interstitial.revenue" + JSON.stringify(data));
120
+ });
121
+
122
+
123
+
@@ -0,0 +1,125 @@
1
+
2
+
3
+ let isRewardedLoad = false;
4
+
5
+ function loadRewarded() {
6
+
7
+ if (typeof cordova !== 'undefined') {
8
+ cordova.plugins.emiAdmobPlugin.loadRewardedAd({ adUnitId: Rewarded_ID, autoShow: false });
9
+ }
10
+
11
+ }
12
+
13
+ function showRewarded() {
14
+
15
+ if (typeof cordova !== 'undefined') {
16
+ if (isRewardedLoad) {
17
+ cordova.plugins.emiAdmobPlugin.showRewardedAd();
18
+ }
19
+ }
20
+
21
+ }
22
+
23
+ /*
24
+ on.rewarded.loaded
25
+ on.rewarded.failed.load
26
+ on.rewarded.click
27
+ on.rewarded.dismissed
28
+ on.rewarded.failed.show
29
+ on.rewarded.impression
30
+ on.rewarded.show
31
+ on.reward.userEarnedReward
32
+ on.rewarded.ad.skip
33
+
34
+ // New event plugin v1.5.5 or higher
35
+
36
+ on.rewarded.revenue
37
+ on.rewardedAd.responseInfo
38
+
39
+ */
40
+
41
+
42
+
43
+ document.addEventListener('on.rewarded.loaded', () => {
44
+ isRewardedLoad = true;
45
+ console.log("on rewarded Ad loaded");
46
+ window.log.value += ("\n on rewarded Ad loaded");
47
+ });
48
+
49
+
50
+ document.addEventListener('on.rewarded.failed.load', (error) => {
51
+ isRewardedLoad = false;
52
+ console.log("on.rewarded.failed.load" + JSON.stringify(error));
53
+
54
+ window.log.value += ("\n on.rewarded.failed.load" + JSON.stringify(error));
55
+ });
56
+
57
+
58
+ document.addEventListener('on.rewarded.failed.show', (error) => {
59
+ isRewardedLoad = false;
60
+ console.log("on.rewarded.failed.show" + JSON.stringify(error));
61
+
62
+ window.log.value += ("\n on.rewarded.failed.show" + JSON.stringify(error));
63
+ });
64
+
65
+
66
+ document.addEventListener('on.reward.userEarnedReward', (rewarded) => {
67
+ // Give gifts to users here
68
+ isRewardedLoad = false;
69
+ console.log("Give gifts to users here" + JSON.stringify(rewarded));
70
+ // const rewardAmount = rewarded.amount;
71
+ // const rewardType = rewarded.currency;
72
+ window.log.value += ("\n Give gifts to users here" + JSON.stringify(rewarded));
73
+ });
74
+
75
+
76
+ // all events that contain the keyword dismissed there is a block to load the ad after it is closed by the user.
77
+ document.addEventListener('on.rewarded.dismissed', () => {
78
+ isRewardedLoad = false;
79
+ console.log("on interstitial Ad dismissed");
80
+ console.log("you can load ads automatically after the ads are closed by users");
81
+ loadRewarded();
82
+
83
+ window.log.value += ("\n you can load ads automatically after the ads are closed by users");
84
+
85
+ });
86
+
87
+
88
+
89
+
90
+
91
+ /*
92
+ // DEBUG
93
+ // isResponseInfo: true, // debug Default false
94
+ document.addEventListener('on.rewardedAd.responseInfo', (data) => {
95
+
96
+ console.log("on.rewardedAd.responseInfo" + JSON.stringify(data));
97
+ if (window.log) window.log.value += ("\n on.rewardedAd.responseInfo" + JSON.stringify(data));
98
+ });
99
+
100
+ */
101
+
102
+
103
+
104
+
105
+
106
+ /*
107
+ https://support.google.com/admob/answer/11322405
108
+
109
+ Turn on the setting for impression-level ad revenue in your AdMob account:
110
+ Sign in to your AdMob account at https://apps.admob.com.
111
+ Click Settings in the sidebar.
112
+ Click the Account tab.
113
+ In the Account controls section, click the Impression-level ad revenue toggle to turn on this setting.
114
+ */
115
+
116
+ document.addEventListener('on.rewarded.revenue', (data) => {
117
+
118
+ console.log(data.value)
119
+ console.log(data.currencyCode)
120
+ console.log(data.precision)
121
+ console.log(data.adUnitId)
122
+
123
+ // console.log("on.rewarded.revenue" + JSON.stringify(data));
124
+ if (window.log) window.log.value += ("\n on.rewarded.revenue" + JSON.stringify(data));
125
+ });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "emi-indo-cordova-plugin-admob",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "Cordova Plugin Admob Android IOS",
5
5
  "cordova": {
6
6
  "id": "emi-indo-cordova-plugin-admob",
7
7
  "platforms": [
8
8
  "android",
9
- "ios"
9
+ "ios"
10
10
  ]
11
11
  },
12
12
  "keywords": [
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.5.3">
3
+ id="emi-indo-cordova-plugin-admob" version="1.5.5">
4
4
 
5
5
  <name>emiAdmobPlugin</name>
6
6
  <description>Cordova Plugin Admob Android IOS</description>
@@ -61,11 +61,11 @@
61
61
  <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
62
62
 
63
63
  <preference name="APP_ID_ANDROID" default="ca-app-pub-3940256099942544~3347511713" />
64
- <preference name="PLAY_SERVICES_VERSION" default="23.4.0" />
64
+ <preference name="PLAY_SERVICES_VERSION" default="23.5.0" />
65
65
 
66
66
  <framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />
67
67
 
68
- <preference name="UMP" default="3.0.0" />
68
+ <preference name="UMP" default="3.1.0" />
69
69
  <framework src="com.google.android.ump:user-messaging-platform:$UMP" />
70
70
 
71
71
  <!-- Dependency Consent status will automatically reset after 12 months -->
@@ -74,8 +74,7 @@
74
74
 
75
75
 
76
76
  <config-file parent="/*" target="AndroidManifest.xml" />
77
- <source-file src="src/android/emiAdmobPlugin.kt"
78
- target-dir="app/src/main/kotlin/emi/indo/cordova/plugin/admob" />
77
+ <source-file src="src/android/emiAdmobPlugin.kt" target-dir="app/src/main/kotlin/emi/indo/cordova/plugin/admob" />
79
78
 
80
79
  </platform>
81
80