cordova-plugin-admob-nextgen 1.0.1 → 1.0.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 +31 -8
- package/capacitor-hook-admob-ids.js +96 -21
- package/package.json +3 -2
- package/plugin.xml +107 -3
- package/src/ios/AdMobNextGen.h +38 -0
- package/src/ios/AdMobNextGen.m +175 -0
- package/src/ios/AppOpenAdExecutor.h +15 -0
- package/src/ios/AppOpenAdExecutor.m +212 -0
- package/src/ios/BannerExecutor.h +15 -0
- package/src/ios/BannerExecutor.m +379 -0
- package/src/ios/ConsentExecutor.h +19 -0
- package/src/ios/ConsentExecutor.m +295 -0
- package/src/ios/GlobalSettingsExecutor.h +15 -0
- package/src/ios/GlobalSettingsExecutor.m +136 -0
- package/src/ios/InterstitialExecutor.h +13 -0
- package/src/ios/InterstitialExecutor.m +165 -0
- package/src/ios/RewardedExecutor.h +13 -0
- package/src/ios/RewardedExecutor.m +172 -0
- package/src/ios/RewardedInterstitialExecutor.h +13 -0
- package/src/ios/RewardedInterstitialExecutor.m +199 -0
- package/www/admob-nextgen.js +8 -0
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Cordova AdMob Next-Gen Plugin
|
|
2
2
|
|
|
3
3
|
[](https://www.android.com)
|
|
4
|
+
[](https://www.apple.com/ios)
|
|
4
5
|
[](https://ads-developers.googleblog.com/2026/01/announcing-google-mobile-ads-next-gen.html)
|
|
5
6
|
[](LICENSE)
|
|
6
7
|
|
|
@@ -69,16 +70,14 @@ We prioritize the safety of your AdMob account and the stability of your app.
|
|
|
69
70
|
### Option A: Via CLI
|
|
70
71
|
Install the plugin directly using the Cordova CLI. You must provide your AdMob App ID.
|
|
71
72
|
|
|
72
|
-
cordova plugin add cordova-plugin-admob-nextgen --save --variable APP_ID_ANDROID="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"
|
|
73
|
+
cordova plugin add cordova-plugin-admob-nextgen --save --variable APP_ID_ANDROID="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" --variable APP_ID_IOS="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"
|
|
73
74
|
|
|
74
75
|
### Option B: Via config.xml
|
|
75
76
|
Add this to your `config.xml` to restore the plugin automatically.
|
|
76
77
|
|
|
77
78
|
<plugin name="cordova-plugin-admob-nextgen" spec="latest">
|
|
78
79
|
<variable name="APP_ID_ANDROID" value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
|
|
79
|
-
|
|
80
|
-
<variable name="NEXT_GEN_SDK_VERSION" value="0.23.0-beta01" />
|
|
81
|
-
<variable name="UMP_VERSION" value="4.0.0" />
|
|
80
|
+
<variable name="APP_ID_IOS" value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />
|
|
82
81
|
</plugin>
|
|
83
82
|
|
|
84
83
|
|
|
@@ -87,9 +86,10 @@ Add this to your `config.xml` to restore the plugin automatically.
|
|
|
87
86
|
|
|
88
87
|
**[⚡ AdMob Next Gen - Starter Templates 🚀 ](https://github.com/swaplab-engine/cordova-plugin-admob-nextgen-template)**.
|
|
89
88
|
|
|
90
|
-
|
|
91
89
|
---
|
|
92
90
|
|
|
91
|
+
**[⚡ FULL Cordova - simple example 🚀 ](https://github.com/swaplab-engine/cordova-plugin-admob-nextgen/tree/main/simple-example/www/js)**.
|
|
92
|
+
|
|
93
93
|
## 2. Configuration & Initialization (CRITICAL)
|
|
94
94
|
|
|
95
95
|
**IMPORTANT:** Configure Global Settings and handle Privacy Consent (UMP) **BEFORE** initializing the SDK.
|
|
@@ -153,7 +153,30 @@ Add this to your `config.xml` to restore the plugin automatically.
|
|
|
153
153
|
});
|
|
154
154
|
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
### App Tracking Transparency (ATT / IDFA) - iOS Only
|
|
157
|
+
For iOS 14+, Apple requires you to prompt the user before tracking their IDFA.
|
|
158
|
+
The plugin provides manual control over this prompt so you can display it at the right time in your app's lifecycle.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
function checkAppTracking() {
|
|
162
|
+
admobNextGen.requestTrackingAuthorization(
|
|
163
|
+
function(status) {
|
|
164
|
+
console.log("ATT Status: " + status);
|
|
165
|
+
// Returns: 'AUTHORIZED', 'DENIED', 'NOT_DETERMINED', 'RESTRICTED'
|
|
166
|
+
|
|
167
|
+
// Regardless of the ATT choice, initialize the SDK
|
|
168
|
+
startSdk();
|
|
169
|
+
},
|
|
170
|
+
function(err) {
|
|
171
|
+
console.warn("ATT Request Failed", err);
|
|
172
|
+
startSdk();
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// You can also silently check the status anytime:
|
|
178
|
+
// admobNextGen.getTrackingAuthorizationStatus(success, error);
|
|
179
|
+
```
|
|
157
180
|
|
|
158
181
|
### Step 3: Check Consent Status (Smart Analysis)
|
|
159
182
|
You can check if the user has granted permission for Personalized Ads without parsing complex IAB strings manually.
|
|
@@ -215,7 +238,7 @@ Supports **Adaptive**, **Standard**, and **Collapsible** banners.
|
|
|
215
238
|
|
|
216
239
|
---
|
|
217
240
|
|
|
218
|
-
## 4. Native Ads (Advanced Overlay)
|
|
241
|
+
## 4. Native Ads (Advanced Overlay) - Android Only
|
|
219
242
|
|
|
220
243
|
High-performance native templates.
|
|
221
244
|
|
|
@@ -258,7 +281,7 @@ High-performance native templates.
|
|
|
258
281
|
|
|
259
282
|
---
|
|
260
283
|
|
|
261
|
-
## 5. Ad Preloading (Banner)
|
|
284
|
+
## 5. Ad Preloading (Banner) - Android Only
|
|
262
285
|
|
|
263
286
|
Use the background engine to pool ads for 0ms latency.
|
|
264
287
|
|
|
@@ -8,9 +8,12 @@ const configPath = fs.existsSync(path.join(rootPath, 'capacitor.config.ts'))
|
|
|
8
8
|
|
|
9
9
|
const manifestPath = path.join(rootPath, 'android/app/src/main/AndroidManifest.xml');
|
|
10
10
|
const gradlePath = path.join(rootPath, 'android/app/build.gradle');
|
|
11
|
+
const iosPlistPath = path.join(rootPath, 'ios/App/App/Info.plist');
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* ---------------------------------------------------------
|
|
15
|
+
* ANDROID HOOKS
|
|
16
|
+
* ---------------------------------------------------------
|
|
14
17
|
*/
|
|
15
18
|
function updateAndroidManifest(appId) {
|
|
16
19
|
if (!fs.existsSync(manifestPath)) return;
|
|
@@ -24,12 +27,9 @@ function updateAndroidManifest(appId) {
|
|
|
24
27
|
content = content.replace('</application>', ` ${newTag}\n </application>`);
|
|
25
28
|
}
|
|
26
29
|
fs.writeFileSync(manifestPath, content, 'utf8');
|
|
27
|
-
console.log(`[AdMob Hook] Success: Updated App ID to ${appId}`);
|
|
30
|
+
console.log(`[AdMob Hook] Success: Updated Android App ID to ${appId}`);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
/**
|
|
31
|
-
* Updates build.gradle with specific SDK and UMP versions
|
|
32
|
-
*/
|
|
33
33
|
function updateGradleDependencies(nextGenVersion, umpVersion) {
|
|
34
34
|
if (!fs.existsSync(gradlePath)) return;
|
|
35
35
|
let content = fs.readFileSync(gradlePath, 'utf8');
|
|
@@ -44,34 +44,104 @@ function updateGradleDependencies(nextGenVersion, umpVersion) {
|
|
|
44
44
|
if (umpRegex.test(content)) content = content.replace(umpRegex, newUmp);
|
|
45
45
|
|
|
46
46
|
fs.writeFileSync(gradlePath, content, 'utf8');
|
|
47
|
-
console.log(`[AdMob Hook] Success: Updated Next Gen SDK to ${nextGenVersion} and UMP to ${umpVersion}`);
|
|
47
|
+
console.log(`[AdMob Hook] Success: Updated Android Next Gen SDK to ${nextGenVersion} and UMP to ${umpVersion}`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function injectExclusionRules() {
|
|
51
51
|
if (!fs.existsSync(gradlePath)) return;
|
|
52
52
|
let content = fs.readFileSync(gradlePath, 'utf8');
|
|
53
53
|
|
|
54
|
-
if (content.includes('exclude group: "com.google.android.gms", module: "play-services-ads"'))
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
54
|
+
if (content.includes('exclude group: "com.google.android.gms", module: "play-services-ads"')) return;
|
|
57
55
|
|
|
58
56
|
const exclusionBlock = `
|
|
59
57
|
// [AdMob Next Gen] Exclude Legacy SDK to prevent duplicates
|
|
60
58
|
configurations.configureEach {
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
exclude group: "com.google.android.gms", module: "play-services-ads"
|
|
60
|
+
exclude group: "com.google.android.gms", module: "play-services-ads-lite"
|
|
63
61
|
}
|
|
64
62
|
`;
|
|
65
|
-
|
|
66
63
|
content += exclusionBlock;
|
|
67
|
-
|
|
68
64
|
fs.writeFileSync(gradlePath, content, 'utf8');
|
|
69
65
|
console.log('[AdMob Hook] Success: Injected legacy SDK exclusion rules into build.gradle');
|
|
70
66
|
}
|
|
71
67
|
|
|
68
|
+
/**
|
|
69
|
+
* ---------------------------------------------------------
|
|
70
|
+
* IOS HOOKS (THE NEW SMART ENGINE)
|
|
71
|
+
* ---------------------------------------------------------
|
|
72
|
+
*/
|
|
73
|
+
function updateIosInfoPlist(appIdIos) {
|
|
74
|
+
if (!fs.existsSync(iosPlistPath)) {
|
|
75
|
+
console.warn('[AdMob Hook] Warning: ios/App/App/Info.plist not found. Run "npx cap add ios" first.');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let content = fs.readFileSync(iosPlistPath, 'utf8');
|
|
80
|
+
|
|
81
|
+
function setStringKey(key, value) {
|
|
82
|
+
const regex = new RegExp(`<key>${key}</key>\\s*<string>.*?</string>`, 's');
|
|
83
|
+
const replacement = `<key>${key}</key>\n\t<string>${value}</string>`;
|
|
84
|
+
if (regex.test(content)) {
|
|
85
|
+
content = content.replace(regex, replacement);
|
|
86
|
+
} else {
|
|
87
|
+
content = content.replace('</dict>\n</plist>', `\t${replacement}\n</dict>\n</plist>`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function setBoolKey(key, value) {
|
|
92
|
+
const boolStr = value ? '<true/>' : '<false/>';
|
|
93
|
+
const regex = new RegExp(`<key>${key}</key>\\s*<(true|false)\\/>`, 's');
|
|
94
|
+
const replacement = `<key>${key}</key>\n\t${boolStr}`;
|
|
95
|
+
if (regex.test(content)) {
|
|
96
|
+
content = content.replace(regex, replacement);
|
|
97
|
+
} else {
|
|
98
|
+
content = content.replace('</dict>\n</plist>', `\t${replacement}\n</dict>\n</plist>`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
setStringKey('GADApplicationIdentifier', appIdIos);
|
|
103
|
+
|
|
104
|
+
setStringKey('NSUserTrackingUsageDescription', 'This identifier will be used to deliver personalized ads to you.');
|
|
105
|
+
|
|
106
|
+
setBoolKey('GADDelayAppMeasurementInit', true);
|
|
107
|
+
|
|
108
|
+
if (!content.includes('<key>SKAdNetworkItems</key>')) {
|
|
109
|
+
const skAdNetworks = [
|
|
110
|
+
'cstr6suwn9.skadnetwork', '4fzdc2evr5.skadnetwork', '2fnua5tdw4.skadnetwork', 'ydx93a7ass.skadnetwork',
|
|
111
|
+
'p78axxw29g.skadnetwork', 'v72qych5uu.skadnetwork', 'ludvb6z3bs.skadnetwork', 'cp8zw746q7.skadnetwork',
|
|
112
|
+
'3sh42y64q3.skadnetwork', 'c6k4g5qg8m.skadnetwork', 's39g8k73mm.skadnetwork', 'wg4vff78zm.skadnetwork',
|
|
113
|
+
'3qy4746246.skadnetwork', 'f38h382jlk.skadnetwork', 'hs6bdukanm.skadnetwork', 'mlmmfzh3r3.skadnetwork',
|
|
114
|
+
'v4nxqhlyqp.skadnetwork', 'wzmmz9fp6w.skadnetwork', 'su67r6k2v3.skadnetwork', 'yclnxrl5pm.skadnetwork',
|
|
115
|
+
't38b2kh725.skadnetwork', '7ug5zh24hu.skadnetwork', 'gta9lk7p23.skadnetwork', 'vutu7akeur.skadnetwork',
|
|
116
|
+
'y5ghdn5j9k.skadnetwork', 'v9wttpbfk9.skadnetwork', 'n38lu8286q.skadnetwork', '47vhws6wlr.skadnetwork',
|
|
117
|
+
'kbd757ywx3.skadnetwork', '9t245vhmpl.skadnetwork', 'a2p9lx4jpn.skadnetwork', '22mmun2rn5.skadnetwork',
|
|
118
|
+
'44jx6755aq.skadnetwork', 'k674qkevps.skadnetwork', '4468km3ulz.skadnetwork', '2u9pt9hc89.skadnetwork',
|
|
119
|
+
'8s468mfl3y.skadnetwork', 'klf5c3l5u5.skadnetwork', 'ppxm28t8ap.skadnetwork', 'uw77j35x4d.skadnetwork',
|
|
120
|
+
'578prtvx9j.skadnetwork', '4dzt52r2t5.skadnetwork', 'tl55sbb4fm.skadnetwork', 'e5fvkxwrpn.skadnetwork',
|
|
121
|
+
'8c4e2ghe7u.skadnetwork', '3rd42ekr43.skadnetwork', '3qcr597p9d.skadnetwork'
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
let dicts = skAdNetworks.map(id => `\t\t<dict>\n\t\t\t<key>SKAdNetworkIdentifier</key>\n\t\t\t<string>${id}</string>\n\t\t</dict>`).join('\n');
|
|
125
|
+
let arrayBlock = `\t<key>SKAdNetworkItems</key>\n\t<array>\n${dicts}\n\t</array>`;
|
|
126
|
+
|
|
127
|
+
content = content.replace('</dict>\n</plist>', `${arrayBlock}\n</dict>\n</plist>`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
fs.writeFileSync(iosPlistPath, content, 'utf8');
|
|
131
|
+
console.log(`[AdMob Hook] Success: Updated iOS Info.plist with App ID (${appIdIos}), ATT prompt, and SKAdNetworks.`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* ---------------------------------------------------------
|
|
136
|
+
* MAIN RUNNER
|
|
137
|
+
* ---------------------------------------------------------
|
|
138
|
+
*/
|
|
72
139
|
function run() {
|
|
73
140
|
try {
|
|
74
|
-
if (!fs.existsSync(configPath))
|
|
141
|
+
if (!fs.existsSync(configPath)) {
|
|
142
|
+
console.warn('[AdMob Hook] capacitor.config not found. Skipping auto-injection.');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
75
145
|
|
|
76
146
|
const configContent = fs.readFileSync(configPath, 'utf8');
|
|
77
147
|
let admob;
|
|
@@ -79,28 +149,33 @@ function run() {
|
|
|
79
149
|
if (configPath.endsWith('.json')) {
|
|
80
150
|
admob = JSON.parse(configContent).plugins?.AdMob;
|
|
81
151
|
} else {
|
|
82
|
-
//
|
|
83
|
-
const
|
|
152
|
+
// Extract from .ts
|
|
153
|
+
const appIdAndroid = configContent.match(/APP_ID_ANDROID:\s*['"](.*?)['"]/);
|
|
154
|
+
const appIdIos = configContent.match(/APP_ID_IOS:\s*['"](.*?)['"]/);
|
|
84
155
|
const sdk = configContent.match(/NEXT_GEN_SDK_VERSION:\s*['"](.*?)['"]/);
|
|
85
156
|
const ump = configContent.match(/UMP_VERSION:\s*['"](.*?)['"]/);
|
|
157
|
+
|
|
86
158
|
admob = {
|
|
87
|
-
APP_ID_ANDROID:
|
|
88
|
-
|
|
159
|
+
APP_ID_ANDROID: appIdAndroid ? appIdAndroid[1] : "ca-app-pub-3940256099942544~3347511713",
|
|
160
|
+
APP_ID_IOS: appIdIos ? appIdIos[1] : "ca-app-pub-3940256099942544~1458002511",
|
|
161
|
+
NEXT_GEN_SDK_VERSION: sdk ? sdk[1] : "0.25.0-beta01",
|
|
89
162
|
UMP_VERSION: ump ? ump[1] : "4.0.0"
|
|
90
163
|
};
|
|
91
164
|
}
|
|
92
165
|
|
|
93
166
|
if (admob?.APP_ID_ANDROID) updateAndroidManifest(admob.APP_ID_ANDROID);
|
|
94
|
-
|
|
95
167
|
injectExclusionRules();
|
|
96
|
-
|
|
97
168
|
if (admob?.NEXT_GEN_SDK_VERSION || admob?.UMP_VERSION) {
|
|
98
169
|
updateGradleDependencies(
|
|
99
|
-
admob.NEXT_GEN_SDK_VERSION || "0.
|
|
170
|
+
admob.NEXT_GEN_SDK_VERSION || "0.25.0-beta01",
|
|
100
171
|
admob.UMP_VERSION || "4.0.0"
|
|
101
172
|
);
|
|
102
173
|
}
|
|
103
174
|
|
|
175
|
+
if (admob?.APP_ID_IOS) {
|
|
176
|
+
updateIosInfoPlist(admob.APP_ID_IOS);
|
|
177
|
+
}
|
|
178
|
+
|
|
104
179
|
} catch (err) {
|
|
105
180
|
console.error('[AdMob Hook] Error:', err.message);
|
|
106
181
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-admob-nextgen",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Google Mobile Ads Next Gen SDK for Cordova. High performance and modular architecture. ",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "cordova-plugin-admob-nextgen",
|
|
7
7
|
"platforms": [
|
|
8
|
-
"android"
|
|
8
|
+
"android",
|
|
9
|
+
"ios"
|
|
9
10
|
]
|
|
10
11
|
},
|
|
11
12
|
"repository": {
|
package/plugin.xml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
2
|
<plugin id="cordova-plugin-admob-nextgen"
|
|
3
|
-
version="1.0.
|
|
3
|
+
version="1.0.3"
|
|
4
4
|
xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
5
5
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
6
6
|
|
|
7
7
|
<name>AdMob Next Gen</name>
|
|
8
|
-
<description>Google Mobile Ads Next Gen SDK for Cordova</description>
|
|
8
|
+
<description>Google Mobile Ads Next Gen SDK for Cordova including capacitors</description>
|
|
9
9
|
<author>EMI INDO</author>
|
|
10
10
|
<license>MIT</license>
|
|
11
11
|
|
|
@@ -47,8 +47,112 @@
|
|
|
47
47
|
|
|
48
48
|
</platform>
|
|
49
49
|
|
|
50
|
-
<preference name="NEXT_GEN_SDK_VERSION" default="0.
|
|
50
|
+
<preference name="NEXT_GEN_SDK_VERSION" default="0.25.0-beta01" />
|
|
51
51
|
<preference name="UMP_VERSION" default="4.0.0" />
|
|
52
52
|
<preference name="APP_ID_ANDROID" default="ca-app-pub-3940256099942544~3347511713" />
|
|
53
53
|
|
|
54
|
+
<platform name="ios">
|
|
55
|
+
<config-file target="config.xml" parent="/*">
|
|
56
|
+
<feature name="AdMobNextGen">
|
|
57
|
+
<param name="ios-package" value="AdMobNextGen" />
|
|
58
|
+
<param name="onload" value="true" />
|
|
59
|
+
</feature>
|
|
60
|
+
</config-file>
|
|
61
|
+
|
|
62
|
+
<config-file target="*-Info.plist" parent="GADApplicationIdentifier">
|
|
63
|
+
<string>$APP_ID_IOS</string>
|
|
64
|
+
</config-file>
|
|
65
|
+
|
|
66
|
+
<config-file target="*-Info.plist" parent="NSUserTrackingUsageDescription">
|
|
67
|
+
<string>This identifier will be used to deliver personalized ads to you.</string>
|
|
68
|
+
</config-file>
|
|
69
|
+
|
|
70
|
+
<config-file target="*-Info.plist" parent="SKAdNetworkItems">
|
|
71
|
+
<array>
|
|
72
|
+
<dict><key>SKAdNetworkIdentifier</key><string>cstr6suwn9.skadnetwork</string></dict>
|
|
73
|
+
<dict><key>SKAdNetworkIdentifier</key><string>4fzdc2evr5.skadnetwork</string></dict>
|
|
74
|
+
<dict><key>SKAdNetworkIdentifier</key><string>2fnua5tdw4.skadnetwork</string></dict>
|
|
75
|
+
<dict><key>SKAdNetworkIdentifier</key><string>ydx93a7ass.skadnetwork</string></dict>
|
|
76
|
+
<dict><key>SKAdNetworkIdentifier</key><string>p78axxw29g.skadnetwork</string></dict>
|
|
77
|
+
<dict><key>SKAdNetworkIdentifier</key><string>v72qych5uu.skadnetwork</string></dict>
|
|
78
|
+
<dict><key>SKAdNetworkIdentifier</key><string>ludvb6z3bs.skadnetwork</string></dict>
|
|
79
|
+
<dict><key>SKAdNetworkIdentifier</key><string>cp8zw746q7.skadnetwork</string></dict>
|
|
80
|
+
<dict><key>SKAdNetworkIdentifier</key><string>3sh42y64q3.skadnetwork</string></dict>
|
|
81
|
+
<dict><key>SKAdNetworkIdentifier</key><string>c6k4g5qg8m.skadnetwork</string></dict>
|
|
82
|
+
<dict><key>SKAdNetworkIdentifier</key><string>s39g8k73mm.skadnetwork</string></dict>
|
|
83
|
+
<dict><key>SKAdNetworkIdentifier</key><string>wg4vff78zm.skadnetwork</string></dict>
|
|
84
|
+
<dict><key>SKAdNetworkIdentifier</key><string>3qy4746246.skadnetwork</string></dict>
|
|
85
|
+
<dict><key>SKAdNetworkIdentifier</key><string>f38h382jlk.skadnetwork</string></dict>
|
|
86
|
+
<dict><key>SKAdNetworkIdentifier</key><string>hs6bdukanm.skadnetwork</string></dict>
|
|
87
|
+
<dict><key>SKAdNetworkIdentifier</key><string>mlmmfzh3r3.skadnetwork</string></dict>
|
|
88
|
+
<dict><key>SKAdNetworkIdentifier</key><string>v4nxqhlyqp.skadnetwork</string></dict>
|
|
89
|
+
<dict><key>SKAdNetworkIdentifier</key><string>wzmmz9fp6w.skadnetwork</string></dict>
|
|
90
|
+
<dict><key>SKAdNetworkIdentifier</key><string>su67r6k2v3.skadnetwork</string></dict>
|
|
91
|
+
<dict><key>SKAdNetworkIdentifier</key><string>yclnxrl5pm.skadnetwork</string></dict>
|
|
92
|
+
<dict><key>SKAdNetworkIdentifier</key><string>t38b2kh725.skadnetwork</string></dict>
|
|
93
|
+
<dict><key>SKAdNetworkIdentifier</key><string>7ug5zh24hu.skadnetwork</string></dict>
|
|
94
|
+
<dict><key>SKAdNetworkIdentifier</key><string>gta9lk7p23.skadnetwork</string></dict>
|
|
95
|
+
<dict><key>SKAdNetworkIdentifier</key><string>vutu7akeur.skadnetwork</string></dict>
|
|
96
|
+
<dict><key>SKAdNetworkIdentifier</key><string>y5ghdn5j9k.skadnetwork</string></dict>
|
|
97
|
+
<dict><key>SKAdNetworkIdentifier</key><string>v9wttpbfk9.skadnetwork</string></dict>
|
|
98
|
+
<dict><key>SKAdNetworkIdentifier</key><string>n38lu8286q.skadnetwork</string></dict>
|
|
99
|
+
<dict><key>SKAdNetworkIdentifier</key><string>47vhws6wlr.skadnetwork</string></dict>
|
|
100
|
+
<dict><key>SKAdNetworkIdentifier</key><string>kbd757ywx3.skadnetwork</string></dict>
|
|
101
|
+
<dict><key>SKAdNetworkIdentifier</key><string>9t245vhmpl.skadnetwork</string></dict>
|
|
102
|
+
<dict><key>SKAdNetworkIdentifier</key><string>a2p9lx4jpn.skadnetwork</string></dict>
|
|
103
|
+
<dict><key>SKAdNetworkIdentifier</key><string>22mmun2rn5.skadnetwork</string></dict>
|
|
104
|
+
<dict><key>SKAdNetworkIdentifier</key><string>44jx6755aq.skadnetwork</string></dict>
|
|
105
|
+
<dict><key>SKAdNetworkIdentifier</key><string>k674qkevps.skadnetwork</string></dict>
|
|
106
|
+
<dict><key>SKAdNetworkIdentifier</key><string>4468km3ulz.skadnetwork</string></dict>
|
|
107
|
+
<dict><key>SKAdNetworkIdentifier</key><string>2u9pt9hc89.skadnetwork</string></dict>
|
|
108
|
+
<dict><key>SKAdNetworkIdentifier</key><string>8s468mfl3y.skadnetwork</string></dict>
|
|
109
|
+
<dict><key>SKAdNetworkIdentifier</key><string>klf5c3l5u5.skadnetwork</string></dict>
|
|
110
|
+
<dict><key>SKAdNetworkIdentifier</key><string>ppxm28t8ap.skadnetwork</string></dict>
|
|
111
|
+
<dict><key>SKAdNetworkIdentifier</key><string>kbmxgpxpgc.skadnetwork</string></dict>
|
|
112
|
+
<dict><key>SKAdNetworkIdentifier</key><string>uw77j35x4d.skadnetwork</string></dict>
|
|
113
|
+
<dict><key>SKAdNetworkIdentifier</key><string>578prtvx9j.skadnetwork</string></dict>
|
|
114
|
+
<dict><key>SKAdNetworkIdentifier</key><string>4dzt52r2t5.skadnetwork</string></dict>
|
|
115
|
+
<dict><key>SKAdNetworkIdentifier</key><string>tl55sbb4fm.skadnetwork</string></dict>
|
|
116
|
+
<dict><key>SKAdNetworkIdentifier</key><string>c3frkrj4fj.skadnetwork</string></dict>
|
|
117
|
+
<dict><key>SKAdNetworkIdentifier</key><string>e5fvkxwrpn.skadnetwork</string></dict>
|
|
118
|
+
<dict><key>SKAdNetworkIdentifier</key><string>8c4e2ghe7u.skadnetwork</string></dict>
|
|
119
|
+
<dict><key>SKAdNetworkIdentifier</key><string>3rd42ekr43.skadnetwork</string></dict>
|
|
120
|
+
<dict><key>SKAdNetworkIdentifier</key><string>97r2b46745.skadnetwork</string></dict>
|
|
121
|
+
<dict><key>SKAdNetworkIdentifier</key><string>3qcr597p9d.skadnetwork</string></dict>
|
|
122
|
+
</array>
|
|
123
|
+
</config-file>
|
|
124
|
+
|
|
125
|
+
<framework src="AdSupport.framework" weak="true" />
|
|
126
|
+
<framework src="AppTrackingTransparency.framework" weak="true" />
|
|
127
|
+
|
|
128
|
+
<podspec>
|
|
129
|
+
<config>
|
|
130
|
+
<source url="https://cdn.cocoapods.org/"/>
|
|
131
|
+
</config>
|
|
132
|
+
<pods use-frameworks="true">
|
|
133
|
+
<pod name="GoogleUserMessagingPlatform" spec="~> 3.1.0" />
|
|
134
|
+
<pod name="Google-Mobile-Ads-SDK" spec="~> 13.1.0" />
|
|
135
|
+
</pods>
|
|
136
|
+
</podspec>
|
|
137
|
+
|
|
138
|
+
<header-file src="src/ios/AdMobNextGen.h" />
|
|
139
|
+
<source-file src="src/ios/AdMobNextGen.m" />
|
|
140
|
+
<header-file src="src/ios/ConsentExecutor.h" />
|
|
141
|
+
<source-file src="src/ios/ConsentExecutor.m" />
|
|
142
|
+
<header-file src="src/ios/GlobalSettingsExecutor.h" />
|
|
143
|
+
<source-file src="src/ios/GlobalSettingsExecutor.m" />
|
|
144
|
+
<header-file src="src/ios/AppOpenAdExecutor.h" />
|
|
145
|
+
<source-file src="src/ios/AppOpenAdExecutor.m" />
|
|
146
|
+
<header-file src="src/ios/BannerExecutor.h" />
|
|
147
|
+
<source-file src="src/ios/BannerExecutor.m" />
|
|
148
|
+
<header-file src="src/ios/InterstitialExecutor.h" />
|
|
149
|
+
<source-file src="src/ios/InterstitialExecutor.m" />
|
|
150
|
+
<header-file src="src/ios/RewardedExecutor.h" />
|
|
151
|
+
<source-file src="src/ios/RewardedExecutor.m" />
|
|
152
|
+
<header-file src="src/ios/RewardedInterstitialExecutor.h" />
|
|
153
|
+
<source-file src="src/ios/RewardedInterstitialExecutor.m" />
|
|
154
|
+
</platform>
|
|
155
|
+
|
|
156
|
+
<preference name="APP_ID_IOS" default="ca-app-pub-3940256099942544~1458002511" />
|
|
157
|
+
|
|
54
158
|
</plugin>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#import <Cordova/CDV.h>
|
|
2
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
3
|
+
|
|
4
|
+
@interface AdMobNextGen : CDVPlugin
|
|
5
|
+
|
|
6
|
+
- (void)initialize:(CDVInvokedUrlCommand*)command;
|
|
7
|
+
|
|
8
|
+
- (void)requestConsentInfo:(CDVInvokedUrlCommand*)command;
|
|
9
|
+
- (void)showPrivacyOptionsForm:(CDVInvokedUrlCommand*)command;
|
|
10
|
+
- (void)getTCData:(CDVInvokedUrlCommand*)command;
|
|
11
|
+
- (void)canRequestAds:(CDVInvokedUrlCommand*)command;
|
|
12
|
+
- (void)requestTrackingAuthorization:(CDVInvokedUrlCommand*)command;
|
|
13
|
+
- (void)getTrackingAuthorizationStatus:(CDVInvokedUrlCommand*)command;
|
|
14
|
+
|
|
15
|
+
- (void)setAppVolume:(CDVInvokedUrlCommand*)command;
|
|
16
|
+
- (void)setAppMuted:(CDVInvokedUrlCommand*)command;
|
|
17
|
+
- (void)setRequestConfiguration:(CDVInvokedUrlCommand*)command;
|
|
18
|
+
|
|
19
|
+
- (void)createBanner:(CDVInvokedUrlCommand*)command;
|
|
20
|
+
- (void)showBanner:(CDVInvokedUrlCommand*)command;
|
|
21
|
+
- (void)hideBanner:(CDVInvokedUrlCommand*)command;
|
|
22
|
+
- (void)removeBanner:(CDVInvokedUrlCommand*)command;
|
|
23
|
+
|
|
24
|
+
- (void)createInterstitial:(CDVInvokedUrlCommand*)command;
|
|
25
|
+
- (void)showInterstitial:(CDVInvokedUrlCommand*)command;
|
|
26
|
+
|
|
27
|
+
- (void)createRewarded:(CDVInvokedUrlCommand*)command;
|
|
28
|
+
- (void)showRewarded:(CDVInvokedUrlCommand*)command;
|
|
29
|
+
|
|
30
|
+
- (void)loadAppOpenAd:(CDVInvokedUrlCommand*)command;
|
|
31
|
+
- (void)showAppOpenAd:(CDVInvokedUrlCommand*)command;
|
|
32
|
+
|
|
33
|
+
- (void)createRewardedInterstitial:(CDVInvokedUrlCommand*)command;
|
|
34
|
+
- (void)showRewardedInterstitial:(CDVInvokedUrlCommand*)command;
|
|
35
|
+
|
|
36
|
+
- (void)fireEvent:(NSString *)obj event:(NSString *)eventName withData:(NSString *)jsonStr;
|
|
37
|
+
|
|
38
|
+
@end
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#import "AdMobNextGen.h"
|
|
2
|
+
#import "ConsentExecutor.h"
|
|
3
|
+
#import "GlobalSettingsExecutor.h"
|
|
4
|
+
#import "BannerExecutor.h"
|
|
5
|
+
#import "InterstitialExecutor.h"
|
|
6
|
+
#import "RewardedExecutor.h"
|
|
7
|
+
#import "AppOpenAdExecutor.h"
|
|
8
|
+
#import "RewardedInterstitialExecutor.h"
|
|
9
|
+
|
|
10
|
+
@interface AdMobNextGen()
|
|
11
|
+
@property (nonatomic, strong) ConsentExecutor *consentExecutor;
|
|
12
|
+
@property (nonatomic, strong) GlobalSettingsExecutor *globalSettingsExecutor;
|
|
13
|
+
@property (nonatomic, strong) BannerExecutor *bannerExecutor;
|
|
14
|
+
@property (nonatomic, strong) InterstitialExecutor *interstitialExecutor;
|
|
15
|
+
@property (nonatomic, strong) RewardedExecutor *rewardedExecutor;
|
|
16
|
+
@property (nonatomic, strong) RewardedInterstitialExecutor *rewardedInterstitialExecutor;
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
@implementation AdMobNextGen
|
|
20
|
+
|
|
21
|
+
- (void)pluginInitialize {
|
|
22
|
+
[super pluginInitialize];
|
|
23
|
+
self.consentExecutor = [[ConsentExecutor alloc] initWithPlugin:self];
|
|
24
|
+
self.globalSettingsExecutor = [[GlobalSettingsExecutor alloc] initWithPlugin:self];
|
|
25
|
+
self.bannerExecutor = [[BannerExecutor alloc] initWithPlugin:self];
|
|
26
|
+
self.interstitialExecutor = [[InterstitialExecutor alloc] initWithPlugin:self];
|
|
27
|
+
self.rewardedExecutor = [[RewardedExecutor alloc] initWithPlugin:self];
|
|
28
|
+
[[AppOpenAdExecutor sharedInstance] initializeWithPlugin:self];
|
|
29
|
+
self.rewardedInterstitialExecutor = [[RewardedInterstitialExecutor alloc] initWithPlugin:self];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (void)initialize:(CDVInvokedUrlCommand*)command {
|
|
33
|
+
[self.commandDelegate runInBackground:^{
|
|
34
|
+
[[GADMobileAds sharedInstance] startWithCompletionHandler:^(GADInitializationStatus * _Nonnull status) {
|
|
35
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"Initialization complete."];
|
|
36
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
37
|
+
}];
|
|
38
|
+
}];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#pragma mark - Consent (UMP) Routing
|
|
42
|
+
|
|
43
|
+
- (void)requestConsentInfo:(CDVInvokedUrlCommand*)command {
|
|
44
|
+
NSDictionary *options = nil;
|
|
45
|
+
if (command.arguments.count > 0) {
|
|
46
|
+
options = [command.arguments objectAtIndex:0];
|
|
47
|
+
}
|
|
48
|
+
[self.consentExecutor requestConsentInfo:options command:command];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)showPrivacyOptionsForm:(CDVInvokedUrlCommand*)command {
|
|
52
|
+
[self.consentExecutor showPrivacyOptionsForm:command];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)getTCData:(CDVInvokedUrlCommand*)command {
|
|
56
|
+
[self.consentExecutor getTCData:command];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- (void)canRequestAds:(CDVInvokedUrlCommand *)command {
|
|
60
|
+
[self.consentExecutor canRequestAds:command];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
- (void)requestTrackingAuthorization:(CDVInvokedUrlCommand *)command {
|
|
64
|
+
[self.consentExecutor requestTrackingAuthorization:command];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
- (void)getTrackingAuthorizationStatus:(CDVInvokedUrlCommand *)command {
|
|
68
|
+
[self.consentExecutor getTrackingAuthorizationStatus:command];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#pragma mark - Global Settings Routing
|
|
72
|
+
|
|
73
|
+
- (void)setAppVolume:(CDVInvokedUrlCommand*)command {
|
|
74
|
+
[self.globalSettingsExecutor setAppVolume:command];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- (void)setAppMuted:(CDVInvokedUrlCommand*)command {
|
|
78
|
+
[self.globalSettingsExecutor setAppMuted:command];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (void)setRequestConfiguration:(CDVInvokedUrlCommand*)command {
|
|
82
|
+
[self.globalSettingsExecutor setRequestConfiguration:command];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#pragma mark - Banner Routing
|
|
86
|
+
|
|
87
|
+
- (void)createBanner:(CDVInvokedUrlCommand*)command {
|
|
88
|
+
NSDictionary *options = [command.arguments objectAtIndex:0];
|
|
89
|
+
if (options != nil && [options isKindOfClass:[NSDictionary class]]) {
|
|
90
|
+
[self.bannerExecutor createBanner:options command:command];
|
|
91
|
+
} else {
|
|
92
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid options object."];
|
|
93
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (void)showBanner:(CDVInvokedUrlCommand*)command {
|
|
98
|
+
[self.bannerExecutor showBanner:command];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
- (void)hideBanner:(CDVInvokedUrlCommand*)command {
|
|
102
|
+
[self.bannerExecutor hideBanner:command];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
- (void)removeBanner:(CDVInvokedUrlCommand*)command {
|
|
106
|
+
[self.bannerExecutor removeBanner:command];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
#pragma mark - Interstitial Routing
|
|
110
|
+
|
|
111
|
+
- (void)createInterstitial:(CDVInvokedUrlCommand*)command {
|
|
112
|
+
NSDictionary *options = [command.arguments objectAtIndex:0];
|
|
113
|
+
if (options != nil && [options isKindOfClass:[NSDictionary class]]) {
|
|
114
|
+
[self.interstitialExecutor createInterstitial:options command:command];
|
|
115
|
+
} else {
|
|
116
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid options object."];
|
|
117
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
- (void)showInterstitial:(CDVInvokedUrlCommand*)command {
|
|
122
|
+
[self.interstitialExecutor showInterstitial:command];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
- (void)createRewarded:(CDVInvokedUrlCommand*)command {
|
|
126
|
+
NSDictionary *options = [command.arguments objectAtIndex:0];
|
|
127
|
+
if (options != nil) {
|
|
128
|
+
[self.rewardedExecutor createRewarded:options command:command];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
- (void)showRewarded:(CDVInvokedUrlCommand*)command {
|
|
133
|
+
[self.rewardedExecutor showRewarded:command];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
- (void)loadAppOpenAd:(CDVInvokedUrlCommand*)command {
|
|
137
|
+
NSDictionary *options = [command.arguments objectAtIndex:0];
|
|
138
|
+
if (options != nil) {
|
|
139
|
+
[[AppOpenAdExecutor sharedInstance] loadAppOpenAd:options command:command];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
- (void)showAppOpenAd:(CDVInvokedUrlCommand*)command {
|
|
144
|
+
[[AppOpenAdExecutor sharedInstance] showAppOpenAd:command];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
- (void)createRewardedInterstitial:(CDVInvokedUrlCommand*)command {
|
|
148
|
+
NSDictionary *options = [command.arguments objectAtIndex:0];
|
|
149
|
+
if (options != nil) {
|
|
150
|
+
[self.rewardedInterstitialExecutor createRewardedInterstitial:options command:command];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
- (void)showRewardedInterstitial:(CDVInvokedUrlCommand*)command {
|
|
155
|
+
[self.rewardedInterstitialExecutor showRewardedInterstitial:command];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
#pragma mark - Event Emitter
|
|
159
|
+
|
|
160
|
+
- (void)fireEvent:(NSString *)obj event:(NSString *)eventName withData:(NSString *)jsonStr {
|
|
161
|
+
NSString* js;
|
|
162
|
+
if(obj && [obj isEqualToString:@"window"]) {
|
|
163
|
+
js = [NSString stringWithFormat:@"var evt=document.createEvent(\"UIEvents\");evt.initUIEvent(\"%@\",true,false,window,0);window.dispatchEvent(evt);", eventName];
|
|
164
|
+
} else if(jsonStr && [jsonStr length] > 0) {
|
|
165
|
+
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@',%@);", eventName, jsonStr];
|
|
166
|
+
} else {
|
|
167
|
+
js = [NSString stringWithFormat:@"javascript:cordova.fireDocumentEvent('%@');", eventName];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
171
|
+
[self.commandDelegate evalJs:js];
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
#import <Cordova/CDV.h>
|
|
3
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
4
|
+
|
|
5
|
+
@class AdMobNextGen;
|
|
6
|
+
|
|
7
|
+
@interface AppOpenAdExecutor : NSObject <GADFullScreenContentDelegate>
|
|
8
|
+
|
|
9
|
+
+ (instancetype)sharedInstance;
|
|
10
|
+
|
|
11
|
+
- (void)initializeWithPlugin:(AdMobNextGen *)plugin;
|
|
12
|
+
- (void)loadAppOpenAd:(NSDictionary *)options command:(CDVInvokedUrlCommand *)command;
|
|
13
|
+
- (void)showAppOpenAd:(CDVInvokedUrlCommand *)command;
|
|
14
|
+
|
|
15
|
+
@end
|