@capacitor-community/admob 5.3.0 → 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/README.md +9 -8
- package/dist/docs.json +2 -2
- package/dist/esm/definitions.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,9 +118,9 @@ Don't forget to replace `[APP_ID]` by your AdMob application Id.
|
|
|
118
118
|
import { AdMob } from '@capacitor-community/admob';
|
|
119
119
|
|
|
120
120
|
export async function initialize(): Promise<void> {
|
|
121
|
-
const
|
|
121
|
+
const [consentInfo, trackingInfo] = await Promise.all([AdMob.requestConsentInfo(), AdMob.trackingAuthorizationStatus()]);
|
|
122
122
|
|
|
123
|
-
if (status === 'notDetermined') {
|
|
123
|
+
if (consentInfo.status === AdmobConsentStatus.REQUIRED && trackingInfo.status === 'notDetermined') {
|
|
124
124
|
/**
|
|
125
125
|
* If you want to explain TrackingAuthorization before showing the iOS dialog,
|
|
126
126
|
* you can show the modal here.
|
|
@@ -131,12 +131,13 @@ export async function initialize(): Promise<void> {
|
|
|
131
131
|
* await modal.present();
|
|
132
132
|
* await modal.onDidDismiss(); // Wait for close modal
|
|
133
133
|
**/
|
|
134
|
+
|
|
135
|
+
if (consentInfo.isConsentFormAvailable) {
|
|
136
|
+
await AdMob.showConsentForm();
|
|
137
|
+
} else {
|
|
138
|
+
await AdMob.requestTrackingAuthorization();
|
|
139
|
+
}
|
|
134
140
|
}
|
|
135
|
-
|
|
136
|
-
AdMob.initialize({
|
|
137
|
-
testingDevices: ['2077ef9a63d2b398840261c8221a0c9b'],
|
|
138
|
-
initializeForTesting: true,
|
|
139
|
-
});
|
|
140
141
|
}
|
|
141
142
|
```
|
|
142
143
|
|
|
@@ -340,7 +341,7 @@ AdMob.addListener(RewardAdPluginEvents.Rewarded, async () => {
|
|
|
340
341
|
### initialize(...)
|
|
341
342
|
|
|
342
343
|
```typescript
|
|
343
|
-
initialize(options
|
|
344
|
+
initialize(options?: AdMobInitializationOptions) => Promise<void>
|
|
344
345
|
```
|
|
345
346
|
|
|
346
347
|
Initialize AdMob with <a href="#admobinitializationoptions">AdMobInitializationOptions</a>
|
package/dist/docs.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"methods": [
|
|
8
8
|
{
|
|
9
9
|
"name": "initialize",
|
|
10
|
-
"signature": "(options
|
|
10
|
+
"signature": "(options?: AdMobInitializationOptions) => Promise<void>",
|
|
11
11
|
"parameters": [
|
|
12
12
|
{
|
|
13
13
|
"name": "options",
|
|
14
14
|
"docs": "AdMobInitializationOptions",
|
|
15
|
-
"type": "AdMobInitializationOptions"
|
|
15
|
+
"type": "AdMobInitializationOptions | undefined"
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"returns": "Promise<void>",
|
|
@@ -12,7 +12,7 @@ export interface AdMobPlugin extends AdMobDefinitions {
|
|
|
12
12
|
* @param options AdMobInitializationOptions
|
|
13
13
|
* @since 1.1.2
|
|
14
14
|
*/
|
|
15
|
-
initialize(options
|
|
15
|
+
initialize(options?: AdMobInitializationOptions): Promise<void>;
|
|
16
16
|
/**
|
|
17
17
|
* Confirm requestTrackingAuthorization status (iOS >14)
|
|
18
18
|
*
|