emi-indo-cordova-plugin-admob 1.0.9 → 1.1.9
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/.github/ISSUE_TEMPLATE/bug_report.md +124 -0
- package/README.md +120 -456
- package/example/Advanced topics/auto_load_and_show.html +94 -0
- package/example/{consent.html → Advanced topics/consent.html } +51 -22
- package/example/Advanced topics/globalSettings.html +39 -0
- package/example/Advanced topics/targeting.html +78 -0
- package/example/app_open_ads.html +151 -0
- package/example/banner_ads.html +248 -0
- package/example/interstitial_ads.html +166 -0
- package/example/rewarded_ads.html +185 -0
- package/example/rewarded_interstitial_ads.html +184 -0
- package/package.json +1 -1
- package/plugin.xml +8 -5
- package/src/android/emiAdmobPlugin.java +1 -1
- package/www/emiAdmobPlugin.js +20 -16
- package/example/index.html +0 -338
@@ -0,0 +1,94 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<script type="text/javascript" src="cordova.js"></script>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
|
9
|
+
|
10
|
+
// For example automatically load Interstitial Ad
|
11
|
+
|
12
|
+
// Load Interstitial Ad
|
13
|
+
|
14
|
+
let loadInterstitialAd = () => {
|
15
|
+
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(
|
16
|
+
AdUnitId = "ca-app-pub-3940256099942544/1033173712",
|
17
|
+
npa = "1", // String | 0 | 1
|
18
|
+
responseInfo = true, // boolean
|
19
|
+
|
20
|
+
// Optional
|
21
|
+
(info) => { alert(info) },
|
22
|
+
(error) => { alert(error)
|
23
|
+
|
24
|
+
});
|
25
|
+
|
26
|
+
// call loadInterstitialAd();
|
27
|
+
}
|
28
|
+
|
29
|
+
// Show Interstitial Ad
|
30
|
+
|
31
|
+
let showInterstitialAd = () => {
|
32
|
+
cordova.plugins.emiAdmobPlugin.showInterstitialAd();
|
33
|
+
|
34
|
+
// call showInterstitialAd();
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
// deviceready
|
41
|
+
|
42
|
+
document.addEventListener("deviceready", function(){
|
43
|
+
|
44
|
+
// Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
|
45
|
+
// This needs to be done only once, ideally at app launch.
|
46
|
+
|
47
|
+
cordova.plugins.emiAdmobPlugin.initialize();
|
48
|
+
|
49
|
+
|
50
|
+
// auto load call loadInterstitialAd();
|
51
|
+
|
52
|
+
loadInterstitialAd();
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
// Interstitial EVENT
|
58
|
+
|
59
|
+
/*
|
60
|
+
on.interstitial.loaded
|
61
|
+
on.interstitial.failed.load
|
62
|
+
on.interstitial.click
|
63
|
+
on.interstitial.dismissed
|
64
|
+
on.interstitial.failed.show
|
65
|
+
on.interstitial.impression
|
66
|
+
on.interstitial.show
|
67
|
+
on.interstitial.revenue
|
68
|
+
*/
|
69
|
+
|
70
|
+
document.addEventListener('on.interstitial.loaded', () => {
|
71
|
+
|
72
|
+
// auto show call showInterstitialAd();
|
73
|
+
|
74
|
+
showInterstitialAd();
|
75
|
+
|
76
|
+
console.log("on Interstitial Ad Loaded");
|
77
|
+
|
78
|
+
});
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
}, false);
|
84
|
+
|
85
|
+
</script>
|
86
|
+
|
87
|
+
|
88
|
+
<p> <button onclick="loadInterstitialAd();">Load Interstitial Ad</button></p>
|
89
|
+
<p> <button onclick="showInterstitialAd();">Show Interstitial Ad</button></p>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
</body>
|
94
|
+
</html>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
let _getConsentRequest = () => {
|
16
16
|
cordova.plugins.emiAdmobPlugin.getConsentRequest(
|
17
|
-
|
17
|
+
// Setting Targeting in Device Ready
|
18
18
|
|
19
19
|
(status) => { alert(status) }, // check event code
|
20
20
|
(error) => { alert(error)
|
@@ -35,20 +35,61 @@ let _consentReset = () => {
|
|
35
35
|
|
36
36
|
|
37
37
|
|
38
|
-
document.addEventListener("deviceready", function(){
|
39
38
|
|
40
39
|
|
41
40
|
|
41
|
+
///// >>>>>> Device Ready <<<<<<
|
42
|
+
|
43
|
+
document.addEventListener("deviceready", function(){
|
44
|
+
|
45
|
+
cordova.plugins.emiAdmobPlugin.initialize();
|
42
46
|
|
43
|
-
|
47
|
+
cordova.plugins.emiAdmobPlugin.targeting(
|
48
|
+
TagForChildDirectedTreatment = 0, // value: 0 | -1 | 1
|
49
|
+
TagForUnderAgeOfConsent = 0, // // value: 0 | -1 | 1
|
50
|
+
MaxAdContentRating = "G", // value: G | MA | PG | T | ""
|
44
51
|
|
45
|
-
|
52
|
+
// Optional
|
53
|
+
(info) => { console.log(info)},
|
54
|
+
(error) => { console.log(error)
|
55
|
+
|
56
|
+
});
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
// Consent Event
|
67
|
+
|
68
|
+
|
69
|
+
/*
|
70
|
+
on.consent.info.update
|
71
|
+
on.consent.info.update.failed
|
72
|
+
|
73
|
+
on.consent.status.not_required
|
74
|
+
on.consent.status.obtained
|
75
|
+
on.consent.status.required
|
76
|
+
on.consent.status.unknown
|
77
|
+
|
78
|
+
on.consent.failed.show
|
79
|
+
on.consent.failed.load.from
|
80
|
+
on.consent.form.not.available
|
81
|
+
*/
|
82
|
+
|
83
|
+
|
84
|
+
document.addEventListener('on.consent.info.update', () => {
|
85
|
+
|
86
|
+
alert("on.consent.info.update");
|
46
87
|
|
47
88
|
});
|
48
89
|
|
49
|
-
document.addEventListener('
|
90
|
+
document.addEventListener('on.consent.info.update.failed', () => {
|
50
91
|
|
51
|
-
alert("on
|
92
|
+
alert("on.consent.info.update.failed");
|
52
93
|
|
53
94
|
});
|
54
95
|
|
@@ -56,45 +97,33 @@ alert("on Consen Info Update Failure");
|
|
56
97
|
|
57
98
|
// https://developers.google.com/admob/android/privacy/api/reference/com/google/android/ump/ConsentInformation.ConsentStatus
|
58
99
|
|
59
|
-
document.addEventListener('on.
|
100
|
+
document.addEventListener('on.consent.status.not_required', () => {
|
60
101
|
// Constant Value: 1
|
61
102
|
alert("User consent not required.");
|
62
103
|
|
63
104
|
});
|
64
105
|
|
65
|
-
document.addEventListener('on.
|
106
|
+
document.addEventListener('on.consent.status.obtained', () => {
|
66
107
|
// Constant Value: 3
|
67
108
|
alert("User consent obtained. Personalized vs non-personalized undefined.");
|
68
109
|
|
69
110
|
});
|
70
111
|
|
71
|
-
document.addEventListener('on.
|
112
|
+
document.addEventListener('on.consent.status.required', () => {
|
72
113
|
// Constant Value: 2
|
73
114
|
// is Consent Form Available = the code auto, load Consent Form and consent Form show.
|
74
115
|
alert("User consent required but not yet obtained.");
|
75
116
|
|
76
117
|
});
|
77
118
|
|
78
|
-
document.addEventListener('on.
|
119
|
+
document.addEventListener('on.consent.status.unknown', () => {
|
79
120
|
//Constant Value: 0
|
80
121
|
alert("Consent status is unknown.");
|
81
122
|
|
82
123
|
});
|
83
124
|
|
84
125
|
|
85
|
-
////////////////////////////////////////////////////////////
|
86
|
-
|
87
|
-
document.addEventListener('on.loadConsentFormError', () => {
|
88
126
|
|
89
|
-
alert("on load Consent Form Error");
|
90
|
-
|
91
|
-
});
|
92
|
-
|
93
|
-
document.addEventListener('on.ConsentFormNotAvailable', () => {
|
94
|
-
|
95
|
-
alert("on Consent Form Not Available");
|
96
|
-
|
97
|
-
});
|
98
127
|
|
99
128
|
|
100
129
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<script type="text/javascript" src="cordova.js"></script>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
|
9
|
+
|
10
|
+
// ### As suggested by Google, when the SDK initializes this plugin automatically takes the Global Settings and Targeting values.
|
11
|
+
|
12
|
+
// ### Global Settings
|
13
|
+
|
14
|
+
///// >>>>>> Device Ready <<<<<<
|
15
|
+
|
16
|
+
document.addEventListener("deviceready", function(){
|
17
|
+
|
18
|
+
// Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
|
19
|
+
// This needs to be done only once, ideally at app launch.
|
20
|
+
|
21
|
+
cordova.plugins.emiAdmobPlugin.initialize();
|
22
|
+
|
23
|
+
// Instruction: https://developers.google.com/admob/android/global-settings
|
24
|
+
|
25
|
+
cordova.plugins.emiAdmobPlugin.globalSettings(
|
26
|
+
|
27
|
+
setAppMuted = false, // Type Boolean default: false
|
28
|
+
setAppVolume = 1.0, // Type float
|
29
|
+
enableSameAppKey = false // Type Boolean default: false
|
30
|
+
|
31
|
+
});
|
32
|
+
|
33
|
+
|
34
|
+
}, false);
|
35
|
+
</script>
|
36
|
+
|
37
|
+
|
38
|
+
</body>
|
39
|
+
</html>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<script type="text/javascript" src="cordova.js"></script>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
|
7
|
+
<script>
|
8
|
+
|
9
|
+
|
10
|
+
// ### As suggested by Google, when the SDK initializes this plugin automatically takes the Global Settings and Targeting values.
|
11
|
+
|
12
|
+
// ### Targeting
|
13
|
+
|
14
|
+
///// >>>>>> Device Ready <<<<<<
|
15
|
+
|
16
|
+
document.addEventListener("deviceready", function(){
|
17
|
+
|
18
|
+
// Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
|
19
|
+
// This needs to be done only once, ideally at app launch.
|
20
|
+
|
21
|
+
cordova.plugins.emiAdmobPlugin.initialize();
|
22
|
+
|
23
|
+
//(Auto Loaded during SDK initialize and ad loaded)
|
24
|
+
|
25
|
+
// You can see the value when the ad is loaded, set responseInfo = true
|
26
|
+
|
27
|
+
// Instruction: https://developers.google.com/admob/android/targeting
|
28
|
+
// Overview: https://developers.google.com/android/reference/com/google/android/gms/ads/RequestConfiguration
|
29
|
+
|
30
|
+
cordova.plugins.emiAdmobPlugin.targeting(
|
31
|
+
TagForChildDirectedTreatment = 0, // value: 0 | -1 | 1
|
32
|
+
TagForUnderAgeOfConsent = 0, // // value: 0 | -1 | 1
|
33
|
+
MaxAdContentRating = "G", // value: G | MA | PG | T | ""
|
34
|
+
|
35
|
+
// Optional
|
36
|
+
(info) => { console.log(info)},
|
37
|
+
(error) => { console.log(error)
|
38
|
+
|
39
|
+
});
|
40
|
+
|
41
|
+
// >>>>>>>>>>> Description <<<<<<<<<<<<<<<
|
42
|
+
|
43
|
+
// (TagForChildDirectedTreatment)
|
44
|
+
// Type number:
|
45
|
+
// value: 0 | -1 | 1
|
46
|
+
// (value description)
|
47
|
+
// 0 = FALSE
|
48
|
+
// 1 = TRUE
|
49
|
+
// -1 = UNSPECIFIED
|
50
|
+
// (if else/undefined = false/0)
|
51
|
+
|
52
|
+
///////////////////////////////
|
53
|
+
|
54
|
+
// (TagForUnderAgeOfConsent)
|
55
|
+
// Type number:
|
56
|
+
// value: 0 | -1 | 1
|
57
|
+
// (value description)
|
58
|
+
// 0 = FALSE
|
59
|
+
// 1 = TRUE
|
60
|
+
// -1 = UNSPECIFIED
|
61
|
+
// (if else/undefined = false/0)
|
62
|
+
|
63
|
+
//////////////////////////////
|
64
|
+
|
65
|
+
// (MaxAdContentRating)
|
66
|
+
// Type String:
|
67
|
+
// value: G | MA | PG | T | ""
|
68
|
+
// (value description)
|
69
|
+
// https://developers.google.com/admob/unity/reference/class/google-mobile-ads/api/max-ad-content-rating
|
70
|
+
// (if else/undefined/"" = NULL)
|
71
|
+
|
72
|
+
|
73
|
+
}, false);
|
74
|
+
</script>
|
75
|
+
|
76
|
+
|
77
|
+
</body>
|
78
|
+
</html>
|
@@ -0,0 +1,151 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<script type="text/javascript" src="cordova.js"></script>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
|
7
|
+
<label for="event">Debug Event All response :</label>
|
8
|
+
<textarea id="event" name="event" rows="5" cols="40"></textarea>
|
9
|
+
|
10
|
+
<script>
|
11
|
+
|
12
|
+
let event = document.getElementById('event');
|
13
|
+
|
14
|
+
let cleanText = () => { event.value = '' };
|
15
|
+
|
16
|
+
let debug = false;
|
17
|
+
|
18
|
+
|
19
|
+
// load App Open Ad
|
20
|
+
|
21
|
+
let loadAppOpenAd = () => {
|
22
|
+
|
23
|
+
cordova.plugins.emiAdmobPlugin.loadAppOpenAd(
|
24
|
+
AdUnitId = "ca-app-pub-3940256099942544/3419835294",
|
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.appOpenAd.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
|
+
}
|
54
|
+
|
55
|
+
// Show App Open Ad
|
56
|
+
|
57
|
+
let showAppOpenAd = () => {
|
58
|
+
cordova.plugins.emiAdmobPlugin.showAppOpenAd();
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
///// >>>>>> Device Ready <<<<<<
|
63
|
+
|
64
|
+
|
65
|
+
document.addEventListener("deviceready", function(){
|
66
|
+
|
67
|
+
// Before loading ads, have your app initialize the Google Mobile Ads SDK by calling
|
68
|
+
// This needs to be done only once, ideally at app launch.
|
69
|
+
|
70
|
+
cordova.plugins.emiAdmobPlugin.initialize(
|
71
|
+
// Optional
|
72
|
+
(info) => {
|
73
|
+
event.value += (info)
|
74
|
+
},
|
75
|
+
(error) => {
|
76
|
+
|
77
|
+
event.value += (error)
|
78
|
+
|
79
|
+
});
|
80
|
+
|
81
|
+
// SDK EVENT Initialization
|
82
|
+
|
83
|
+
document.addEventListener('on.sdkInitialization', () => {
|
84
|
+
|
85
|
+
event.value += ("\n On Sdk Initialization");
|
86
|
+
|
87
|
+
|
88
|
+
});
|
89
|
+
|
90
|
+
|
91
|
+
// App Open Ad EVENT
|
92
|
+
|
93
|
+
/*
|
94
|
+
on.appOpenAd.loaded
|
95
|
+
on.appOpenAd.failed.loaded
|
96
|
+
on.appOpenAd.dismissed
|
97
|
+
on.appOpenAd.failed.show
|
98
|
+
on.appOpenAd.show
|
99
|
+
on.appOpenAd.revenue
|
100
|
+
*/
|
101
|
+
|
102
|
+
|
103
|
+
document.addEventListener('on.appOpenAd.loaded', () => {
|
104
|
+
|
105
|
+
event.value += ("\n on.appOpenAd.loaded");
|
106
|
+
|
107
|
+
});
|
108
|
+
|
109
|
+
document.addEventListener('on.appOpenAd.failed.loaded', () => {
|
110
|
+
|
111
|
+
event.value += ("\n on.appOpenAd.failed.loaded");
|
112
|
+
|
113
|
+
});
|
114
|
+
|
115
|
+
document.addEventListener('on.appOpenAd.dismissed', () => {
|
116
|
+
|
117
|
+
event.value += ("\n on.appOpenAd.dismissed");
|
118
|
+
|
119
|
+
});
|
120
|
+
|
121
|
+
document.addEventListener('on.appOpenAd.failed.show', () => {
|
122
|
+
|
123
|
+
event.value += ("\n on.appOpenAd.failed.show");
|
124
|
+
|
125
|
+
});
|
126
|
+
|
127
|
+
document.addEventListener('on.appOpenAd.show', () => {
|
128
|
+
|
129
|
+
event.value += ("\n on.appOpenAd.show");
|
130
|
+
|
131
|
+
});
|
132
|
+
|
133
|
+
document.addEventListener('on.appOpenAd.revenue', () => {
|
134
|
+
|
135
|
+
event.value += ("\n on.appOpenAd.revenue");
|
136
|
+
|
137
|
+
});
|
138
|
+
|
139
|
+
|
140
|
+
}, false);
|
141
|
+
|
142
|
+
</script>
|
143
|
+
|
144
|
+
<p> <button onclick="loadAppOpenAd();">load App Open Ad</button></p>
|
145
|
+
<p> <button onclick="showAppOpenAd();">Show App Open Ad</button></p>
|
146
|
+
|
147
|
+
<p> <button onclick="cleanText();">Clean response Text</button></p>
|
148
|
+
|
149
|
+
|
150
|
+
</body>
|
151
|
+
</html>
|