@capgo/capacitor-admob 7.1.0 → 7.4.4
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/CapgoCapacitorAdmob.podspec +1 -0
- package/Package.swift +4 -2
- package/README.md +102 -44
- package/android/src/main/kotlin/admob/plus/capacitor/AdMobPlusPlugin.kt +12 -0
- package/dist/docs.json +283 -51
- package/dist/esm/definitions.d.ts +206 -3
- package/dist/esm/definitions.js +19 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/plugin.cjs.js +19 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +19 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/AdmobPlusPlugin/AdmobPlusPlugin.swift +223 -10
- package/ios/Sources/AdmobPlusPlugin/BannerAd.swift +143 -0
- package/ios/Sources/AdmobPlusPlugin/Generated.swift +40 -0
- package/ios/Sources/AdmobPlusPlugin/Helper.swift +68 -0
- package/ios/Sources/AdmobPlusPlugin/InterstitialAd.swift +92 -0
- package/ios/Sources/AdmobPlusPlugin/RewardedAd.swift +102 -0
- package/ios/Sources/AdmobPlusPlugin/RewardedInterstitialAd.swift +102 -0
- package/package.json +1 -1
- package/ios/Sources/AdmobPlusPlugin/AdmobPlus.swift +0 -8
package/Package.swift
CHANGED
|
@@ -10,14 +10,16 @@ let package = Package(
|
|
|
10
10
|
targets: ["AdmobPlusPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
|
|
14
|
+
.package(url: "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", from: "11.0.0")
|
|
14
15
|
],
|
|
15
16
|
targets: [
|
|
16
17
|
.target(
|
|
17
18
|
name: "AdmobPlusPlugin",
|
|
18
19
|
dependencies: [
|
|
19
20
|
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
-
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
.product(name: "Cordova", package: "capacitor-swift-pm"),
|
|
22
|
+
.product(name: "GoogleMobileAds", package: "swift-package-manager-google-mobile-ads")
|
|
21
23
|
],
|
|
22
24
|
path: "ios/Sources/AdmobPlusPlugin"),
|
|
23
25
|
.testTarget(
|
package/README.md
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
<a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
|
|
3
3
|
|
|
4
4
|
<div align="center">
|
|
5
|
-
<h2><a href="https://capgo.app/?ref=
|
|
6
|
-
<h2><a href="https://capgo.app/consulting/?ref=
|
|
5
|
+
<h2><a href="https://capgo.app/?ref=plugin_admob"> ➡️ Get Instant updates for your App with Capgo</a></h2>
|
|
6
|
+
<h2><a href="https://capgo.app/consulting/?ref=plugin_admob"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
|
|
7
7
|
</div>
|
|
8
8
|
AdMob SDK bridge for Capacitor apps
|
|
9
9
|
|
|
10
|
+
## Documentation
|
|
11
|
+
|
|
12
|
+
The most complete doc is available here: https://capgo.app/docs/plugins/admob/
|
|
13
|
+
|
|
10
14
|
## Install
|
|
11
15
|
|
|
12
16
|
```bash
|
|
@@ -39,12 +43,18 @@ npx cap sync
|
|
|
39
43
|
<docgen-api>
|
|
40
44
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
41
45
|
|
|
46
|
+
AdMob Plus Plugin interface for displaying Google AdMob ads in Capacitor apps.
|
|
47
|
+
|
|
42
48
|
### start()
|
|
43
49
|
|
|
44
50
|
```typescript
|
|
45
51
|
start() => Promise<void>
|
|
46
52
|
```
|
|
47
53
|
|
|
54
|
+
Initialize and start the AdMob SDK.
|
|
55
|
+
|
|
56
|
+
**Since:** 1.0.0
|
|
57
|
+
|
|
48
58
|
--------------------
|
|
49
59
|
|
|
50
60
|
|
|
@@ -54,9 +64,13 @@ start() => Promise<void>
|
|
|
54
64
|
configure(config: AdMobConfig) => Promise<void>
|
|
55
65
|
```
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
|
67
|
+
Configure AdMob settings.
|
|
68
|
+
|
|
69
|
+
| Param | Type | Description |
|
|
70
|
+
| ------------ | --------------------------------------------------- | --------------------------------- |
|
|
71
|
+
| **`config`** | <code><a href="#admobconfig">AdMobConfig</a></code> | - Configuration options for AdMob |
|
|
72
|
+
|
|
73
|
+
**Since:** 1.0.0
|
|
60
74
|
|
|
61
75
|
--------------------
|
|
62
76
|
|
|
@@ -67,9 +81,13 @@ configure(config: AdMobConfig) => Promise<void>
|
|
|
67
81
|
configRequest(requestConfig: RequestConfig) => Promise<void>
|
|
68
82
|
```
|
|
69
83
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
|
84
|
+
Configure ad request settings.
|
|
85
|
+
|
|
86
|
+
| Param | Type | Description |
|
|
87
|
+
| ------------------- | ------------------------------------------------------- | ------------------------------- |
|
|
88
|
+
| **`requestConfig`** | <code><a href="#requestconfig">RequestConfig</a></code> | - Request configuration options |
|
|
89
|
+
|
|
90
|
+
**Since:** 1.0.0
|
|
73
91
|
|
|
74
92
|
--------------------
|
|
75
93
|
|
|
@@ -80,9 +98,13 @@ configRequest(requestConfig: RequestConfig) => Promise<void>
|
|
|
80
98
|
adCreate<O extends MobileAdOptions>(opts: O) => Promise<void>
|
|
81
99
|
```
|
|
82
100
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
|
101
|
+
Create a new ad instance.
|
|
102
|
+
|
|
103
|
+
| Param | Type | Description |
|
|
104
|
+
| ---------- | -------------- | --------------------------------------------------- |
|
|
105
|
+
| **`opts`** | <code>O</code> | - Options for creating the ad, including ad unit ID |
|
|
106
|
+
|
|
107
|
+
**Since:** 1.0.0
|
|
86
108
|
|
|
87
109
|
--------------------
|
|
88
110
|
|
|
@@ -93,12 +115,16 @@ adCreate<O extends MobileAdOptions>(opts: O) => Promise<void>
|
|
|
93
115
|
adIsLoaded(opts: { id: number; }) => Promise<boolean>
|
|
94
116
|
```
|
|
95
117
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
|
118
|
+
Check if an ad is loaded and ready to be shown.
|
|
119
|
+
|
|
120
|
+
| Param | Type | Description |
|
|
121
|
+
| ---------- | ---------------------------- | ----------------------------- |
|
|
122
|
+
| **`opts`** | <code>{ id: number; }</code> | - Object containing the ad ID |
|
|
99
123
|
|
|
100
124
|
**Returns:** <code>Promise<boolean></code>
|
|
101
125
|
|
|
126
|
+
**Since:** 1.0.0
|
|
127
|
+
|
|
102
128
|
--------------------
|
|
103
129
|
|
|
104
130
|
|
|
@@ -108,9 +134,13 @@ adIsLoaded(opts: { id: number; }) => Promise<boolean>
|
|
|
108
134
|
adLoad(opts: { id: number; }) => Promise<void>
|
|
109
135
|
```
|
|
110
136
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
|
137
|
+
Load an ad.
|
|
138
|
+
|
|
139
|
+
| Param | Type | Description |
|
|
140
|
+
| ---------- | ---------------------------- | ----------------------------- |
|
|
141
|
+
| **`opts`** | <code>{ id: number; }</code> | - Object containing the ad ID |
|
|
142
|
+
|
|
143
|
+
**Since:** 1.0.0
|
|
114
144
|
|
|
115
145
|
--------------------
|
|
116
146
|
|
|
@@ -121,9 +151,13 @@ adLoad(opts: { id: number; }) => Promise<void>
|
|
|
121
151
|
adShow(opts: { id: number; }) => Promise<void>
|
|
122
152
|
```
|
|
123
153
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
|
154
|
+
Show a loaded ad.
|
|
155
|
+
|
|
156
|
+
| Param | Type | Description |
|
|
157
|
+
| ---------- | ---------------------------- | ----------------------------- |
|
|
158
|
+
| **`opts`** | <code>{ id: number; }</code> | - Object containing the ad ID |
|
|
159
|
+
|
|
160
|
+
**Since:** 1.0.0
|
|
127
161
|
|
|
128
162
|
--------------------
|
|
129
163
|
|
|
@@ -134,9 +168,13 @@ adShow(opts: { id: number; }) => Promise<void>
|
|
|
134
168
|
adHide(opts: { id: number; }) => Promise<void>
|
|
135
169
|
```
|
|
136
170
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
|
171
|
+
Hide a currently displayed ad.
|
|
172
|
+
|
|
173
|
+
| Param | Type | Description |
|
|
174
|
+
| ---------- | ---------------------------- | ----------------------------- |
|
|
175
|
+
| **`opts`** | <code>{ id: number; }</code> | - Object containing the ad ID |
|
|
176
|
+
|
|
177
|
+
**Since:** 1.0.0
|
|
140
178
|
|
|
141
179
|
--------------------
|
|
142
180
|
|
|
@@ -147,8 +185,12 @@ adHide(opts: { id: number; }) => Promise<void>
|
|
|
147
185
|
trackingAuthorizationStatus() => Promise<{ status: TrackingAuthorizationStatus | false; }>
|
|
148
186
|
```
|
|
149
187
|
|
|
188
|
+
Get the current tracking authorization status (iOS only).
|
|
189
|
+
|
|
150
190
|
**Returns:** <code>Promise<{ status: false | <a href="#trackingauthorizationstatus">TrackingAuthorizationStatus</a>; }></code>
|
|
151
191
|
|
|
192
|
+
**Since:** 1.0.0
|
|
193
|
+
|
|
152
194
|
--------------------
|
|
153
195
|
|
|
154
196
|
|
|
@@ -158,8 +200,12 @@ trackingAuthorizationStatus() => Promise<{ status: TrackingAuthorizationStatus |
|
|
|
158
200
|
requestTrackingAuthorization() => Promise<{ status: TrackingAuthorizationStatus | false; }>
|
|
159
201
|
```
|
|
160
202
|
|
|
203
|
+
Request tracking authorization from the user (iOS only).
|
|
204
|
+
|
|
161
205
|
**Returns:** <code>Promise<{ status: false | <a href="#trackingauthorizationstatus">TrackingAuthorizationStatus</a>; }></code>
|
|
162
206
|
|
|
207
|
+
**Since:** 1.0.0
|
|
208
|
+
|
|
163
209
|
--------------------
|
|
164
210
|
|
|
165
211
|
|
|
@@ -169,13 +215,17 @@ requestTrackingAuthorization() => Promise<{ status: TrackingAuthorizationStatus
|
|
|
169
215
|
addListener(eventName: string, listenerFunc: (event: any) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
|
|
170
216
|
```
|
|
171
217
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
|
175
|
-
|
|
|
218
|
+
Add a listener for ad events.
|
|
219
|
+
|
|
220
|
+
| Param | Type | Description |
|
|
221
|
+
| ------------------ | ------------------------------------ | -------------------------------------------- |
|
|
222
|
+
| **`eventName`** | <code>string</code> | - The name of the event to listen for |
|
|
223
|
+
| **`listenerFunc`** | <code>(event: any) => void</code> | - The function to call when the event occurs |
|
|
176
224
|
|
|
177
225
|
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>> & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
|
|
178
226
|
|
|
227
|
+
**Since:** 1.0.0
|
|
228
|
+
|
|
179
229
|
--------------------
|
|
180
230
|
|
|
181
231
|
|
|
@@ -185,10 +235,12 @@ addListener(eventName: string, listenerFunc: (event: any) => void) => Promise<Pl
|
|
|
185
235
|
getPluginVersion() => Promise<{ version: string; }>
|
|
186
236
|
```
|
|
187
237
|
|
|
188
|
-
Get the native Capacitor plugin version
|
|
238
|
+
Get the native Capacitor plugin version.
|
|
189
239
|
|
|
190
240
|
**Returns:** <code>Promise<{ version: string; }></code>
|
|
191
241
|
|
|
242
|
+
**Since:** 1.0.0
|
|
243
|
+
|
|
192
244
|
--------------------
|
|
193
245
|
|
|
194
246
|
|
|
@@ -207,17 +259,23 @@ Get the native Capacitor plugin version
|
|
|
207
259
|
|
|
208
260
|
#### AdMobConfig
|
|
209
261
|
|
|
210
|
-
|
|
262
|
+
Configuration options for AdMob.
|
|
263
|
+
|
|
264
|
+
<code>{ /** Whether the app should be muted */ appMuted?: boolean; /** The app volume (0.0 to 1.0) */ appVolume?: number; }</code>
|
|
211
265
|
|
|
212
266
|
|
|
213
267
|
#### RequestConfig
|
|
214
268
|
|
|
215
|
-
|
|
269
|
+
Configuration for ad requests.
|
|
270
|
+
|
|
271
|
+
<code>{ /** Maximum ad content rating */ maxAdContentRating?: <a href="#maxadcontentrating">MaxAdContentRating</a>; /** Whether to use the same app key */ sameAppKey?: boolean; /** Tag for child-directed treatment (true, false, or null for unspecified) */ tagForChildDirectedTreatment?: boolean | null; /** Tag for under age of consent (true, false, or null for unspecified) */ tagForUnderAgeOfConsent?: boolean | null; /** Array of test device IDs */ testDeviceIds?: string[]; }</code>
|
|
216
272
|
|
|
217
273
|
|
|
218
274
|
#### MobileAdOptions
|
|
219
275
|
|
|
220
|
-
|
|
276
|
+
Base options for mobile ads.
|
|
277
|
+
|
|
278
|
+
<code>{ /** The ad unit ID from AdMob */ adUnitId: string; }</code>
|
|
221
279
|
|
|
222
280
|
|
|
223
281
|
### Enums
|
|
@@ -225,22 +283,22 @@ Get the native Capacitor plugin version
|
|
|
225
283
|
|
|
226
284
|
#### MaxAdContentRating
|
|
227
285
|
|
|
228
|
-
| Members | Value |
|
|
229
|
-
| ----------------- | ----------------- |
|
|
230
|
-
| **`G`** | <code>'G'</code> |
|
|
231
|
-
| **`MA`** | <code>'MA'</code> |
|
|
232
|
-
| **`PG`** | <code>'PG'</code> |
|
|
233
|
-
| **`T`** | <code>'T'</code> |
|
|
234
|
-
| **`UNSPECIFIED`** | <code>''</code> |
|
|
286
|
+
| Members | Value | Description |
|
|
287
|
+
| ----------------- | ----------------- | ------------------ |
|
|
288
|
+
| **`G`** | <code>'G'</code> | General Audiences |
|
|
289
|
+
| **`MA`** | <code>'MA'</code> | Mature Audiences |
|
|
290
|
+
| **`PG`** | <code>'PG'</code> | Parental Guidance |
|
|
291
|
+
| **`T`** | <code>'T'</code> | Teen |
|
|
292
|
+
| **`UNSPECIFIED`** | <code>''</code> | Unspecified rating |
|
|
235
293
|
|
|
236
294
|
|
|
237
295
|
#### TrackingAuthorizationStatus
|
|
238
296
|
|
|
239
|
-
| Members | Value |
|
|
240
|
-
| ------------------- | -------------- |
|
|
241
|
-
| **`notDetermined`** | <code>0</code> |
|
|
242
|
-
| **`restricted`** | <code>1</code> |
|
|
243
|
-
| **`denied`** | <code>2</code> |
|
|
244
|
-
| **`authorized`** | <code>3</code> |
|
|
297
|
+
| Members | Value | Description |
|
|
298
|
+
| ------------------- | -------------- | ---------------------------------------------------------- |
|
|
299
|
+
| **`notDetermined`** | <code>0</code> | User has not yet received an authorization request |
|
|
300
|
+
| **`restricted`** | <code>1</code> | User restricted, device is unable to provide authorization |
|
|
301
|
+
| **`denied`** | <code>2</code> | User denied authorization |
|
|
302
|
+
| **`authorized`** | <code>3</code> | User authorized access |
|
|
245
303
|
|
|
246
304
|
</docgen-api>
|
|
@@ -19,6 +19,7 @@ import org.json.JSONObject
|
|
|
19
19
|
|
|
20
20
|
@CapacitorPlugin(name = "AdMobPlus")
|
|
21
21
|
class AdMobPlusPlugin : Plugin(), Helper.Adapter {
|
|
22
|
+
private val pluginVersion = "7.4.1"
|
|
22
23
|
private var helper: Helper? = null
|
|
23
24
|
override fun load() {
|
|
24
25
|
super.load()
|
|
@@ -144,4 +145,15 @@ class AdMobPlusPlugin : Plugin(), Helper.Adapter {
|
|
|
144
145
|
e.printStackTrace()
|
|
145
146
|
}
|
|
146
147
|
}
|
|
148
|
+
|
|
149
|
+
@PluginMethod
|
|
150
|
+
fun getPluginVersion(call: PluginCall) {
|
|
151
|
+
try {
|
|
152
|
+
val ret = JSObject()
|
|
153
|
+
ret.put("version", pluginVersion)
|
|
154
|
+
call.resolve(ret)
|
|
155
|
+
} catch (e: Exception) {
|
|
156
|
+
call.reject("Could not get plugin version", e)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
147
159
|
}
|