Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capacitor-community/admob

Package Overview
Dependencies
Maintainers
42
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/admob - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

android/src/main/java/com/getcapacitor/community/admob/consent/AdConsentExecutor.java

3

dist/esm/definitions.d.ts
import type { BannerDefinitions } from './banner';
import type { AdmobConsentDefinitions } from './consent';
import type { InterstitialDefinitions } from './interstitial';
import type { RewardDefinitions } from './reward';
import type { TrackingAuthorizationStatusInterface } from './shared/tracking-authorization-status.interface';
declare type AdMobDefinitions = BannerDefinitions & RewardDefinitions & InterstitialDefinitions;
declare type AdMobDefinitions = BannerDefinitions & RewardDefinitions & InterstitialDefinitions & AdmobConsentDefinitions;
export interface AdMobPlugin extends AdMobDefinitions {

@@ -7,0 +8,0 @@ /**

@@ -7,3 +7,4 @@ import type { AdMobPlugin } from './definitions';

export * from './reward/index';
export * from './consent/index';
export * from './shared/index';
export { AdMob };

@@ -9,4 +9,5 @@ import { registerPlugin } from '@capacitor/core';

export * from './reward/index';
export * from './consent/index';
export * from './shared/index';
export { AdMob };
//# sourceMappingURL=index.js.map
import { WebPlugin } from '@capacitor/core';
import type { AdMobPlugin, ApplicationMutedOptions, ApplicationVolumeOptions } from '.';
import type { AdMobPlugin, ApplicationMutedOptions, ApplicationVolumeOptions, AdmobConsentInfo, AdmobConsentRequestOptions } from '.';
import type { AdMobRewardItem } from './reward';

@@ -11,2 +11,5 @@ import type { AdOptions, AdLoadInfo } from './shared';

trackingAuthorizationStatus(): Promise<TrackingAuthorizationStatusInterface>;
requestConsentInfo(options?: AdmobConsentRequestOptions): Promise<AdmobConsentInfo>;
showConsentForm(): Promise<AdmobConsentInfo>;
resetConsentInfo(): Promise<void>;
setApplicationMuted(options: ApplicationMutedOptions): Promise<void>;

@@ -13,0 +16,0 @@ setApplicationVolume(options: ApplicationVolumeOptions): Promise<void>;

import { WebPlugin } from '@capacitor/core';
import { AdmobConsentStatus } from './consent/consent-status.enum';
export class AdMobWeb extends WebPlugin {

@@ -20,2 +21,18 @@ constructor() {

}
async requestConsentInfo(options) {
console.log('requestConsentInfo', options);
return {
status: AdmobConsentStatus.REQUIRED,
isConsentFormAvailable: true,
};
}
async showConsentForm() {
console.log('showConsentForm');
return {
status: AdmobConsentStatus.REQUIRED,
};
}
async resetConsentInfo() {
console.log('resetConsentInfo');
}
async setApplicationMuted(options) {

@@ -22,0 +39,0 @@ console.log('setApplicationMuted', options);

@@ -170,2 +170,48 @@ 'use strict';

/**
* For more information:
* https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#consentstatus
*
* */
exports.AdmobConsentStatus = void 0;
(function (AdmobConsentStatus) {
/**
* User consent not required.
*/
AdmobConsentStatus["NOT_REQUIRED"] = "NOT_REQUIRED";
/**
* User consent already obtained.
*/
AdmobConsentStatus["OBTAINED"] = "OBTAINED";
/**
* User consent required but not yet obtained.
*/
AdmobConsentStatus["REQUIRED"] = "REQUIRED";
/**
* Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.
*/
AdmobConsentStatus["UNKNOWN"] = "UNKNOWN";
})(exports.AdmobConsentStatus || (exports.AdmobConsentStatus = {}));
/**
* For more information:
* https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#debuggeography
*
* */
exports.AdmobConsentDebugGeography = void 0;
(function (AdmobConsentDebugGeography) {
/**
* Debug geography disabled.
*/
AdmobConsentDebugGeography[AdmobConsentDebugGeography["DISABLED"] = 0] = "DISABLED";
/**
* Geography appears as in EEA for debug devices.
*/
AdmobConsentDebugGeography[AdmobConsentDebugGeography["EEA"] = 1] = "EEA";
/**
* Geography appears as not in EEA for debug devices.
*/
AdmobConsentDebugGeography[AdmobConsentDebugGeography["NOT_EEA"] = 2] = "NOT_EEA";
})(exports.AdmobConsentDebugGeography || (exports.AdmobConsentDebugGeography = {}));
const AdMob = core.registerPlugin('AdMob', {

@@ -193,2 +239,18 @@ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AdMobWeb()),

}
async requestConsentInfo(options) {
console.log('requestConsentInfo', options);
return {
status: exports.AdmobConsentStatus.REQUIRED,
isConsentFormAvailable: true,
};
}
async showConsentForm() {
console.log('showConsentForm');
return {
status: exports.AdmobConsentStatus.REQUIRED,
};
}
async resetConsentInfo() {
console.log('resetConsentInfo');
}
async setApplicationMuted(options) {

@@ -195,0 +257,0 @@ console.log('setApplicationMuted', options);

@@ -167,2 +167,48 @@ var AdMobPlugin = (function (exports, core) {

/**
* For more information:
* https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#consentstatus
*
* */
exports.AdmobConsentStatus = void 0;
(function (AdmobConsentStatus) {
/**
* User consent not required.
*/
AdmobConsentStatus["NOT_REQUIRED"] = "NOT_REQUIRED";
/**
* User consent already obtained.
*/
AdmobConsentStatus["OBTAINED"] = "OBTAINED";
/**
* User consent required but not yet obtained.
*/
AdmobConsentStatus["REQUIRED"] = "REQUIRED";
/**
* Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.
*/
AdmobConsentStatus["UNKNOWN"] = "UNKNOWN";
})(exports.AdmobConsentStatus || (exports.AdmobConsentStatus = {}));
/**
* For more information:
* https://developers.google.com/admob/unity/reference/namespace/google-mobile-ads/ump/api#debuggeography
*
* */
exports.AdmobConsentDebugGeography = void 0;
(function (AdmobConsentDebugGeography) {
/**
* Debug geography disabled.
*/
AdmobConsentDebugGeography[AdmobConsentDebugGeography["DISABLED"] = 0] = "DISABLED";
/**
* Geography appears as in EEA for debug devices.
*/
AdmobConsentDebugGeography[AdmobConsentDebugGeography["EEA"] = 1] = "EEA";
/**
* Geography appears as not in EEA for debug devices.
*/
AdmobConsentDebugGeography[AdmobConsentDebugGeography["NOT_EEA"] = 2] = "NOT_EEA";
})(exports.AdmobConsentDebugGeography || (exports.AdmobConsentDebugGeography = {}));
const AdMob = core.registerPlugin('AdMob', {

@@ -190,2 +236,18 @@ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AdMobWeb()),

}
async requestConsentInfo(options) {
console.log('requestConsentInfo', options);
return {
status: exports.AdmobConsentStatus.REQUIRED,
isConsentFormAvailable: true,
};
}
async showConsentForm() {
console.log('showConsentForm');
return {
status: exports.AdmobConsentStatus.REQUIRED,
};
}
async resetConsentInfo() {
console.log('resetConsentInfo');
}
async setApplicationMuted(options) {

@@ -192,0 +254,0 @@ console.log('setApplicationMuted', options);

{
"name": "@capacitor-community/admob",
"version": "5.0.0",
"version": "5.1.0",
"description": "A native plugin for AdMob",

@@ -9,2 +9,5 @@ "main": "dist/plugin.cjs.js",

"unpkg": "dist/plugin.js",
"engines": {
"node": ">=16.0.0"
},
"files": [

@@ -55,3 +58,3 @@ "android/src/main/",

"lint-staged": "^11.0.0",
"np": "^7.7.0",
"np": "^8.0.4",
"pre-commit": "^1.2.2",

@@ -58,0 +61,0 @@ "prettier": "~2.3.0",

@@ -137,3 +137,2 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p>

AdMob.initialize({
requestTrackingAuthorization: true,
testingDevices: ['2077ef9a63d2b398840261c8221a0c9b'],

@@ -145,10 +144,39 @@ initializeForTesting: true,

You can use option `requestTrackingAuthorization`. This change permission to require `AppTrackingTransparency` in iOS >= 14:
https://developers.google.com/admob/ios/ios14
Send and array of device Ids in `testingDevices? to use production like ads on your specified devices -> https://developers.google.com/admob/android/test-ads#enable_test_devices
Default value is `true`. If you don't want to track, set requestTrackingAuthorization `false`.
### User Message Platform (UMP)
Send and array of device Ids in `testingDevices? to use production like ads on your specified devices -> https://developers.google.com/admob/android/test-ads#enable_test_devices
Later this year, Google will require all publishers serving ads to EEA and UK users to use a Google-certified Consent Management Platform (CMP)
Currently we just support Google's consent management solution.
To use UMP, you must [create your GDPR messages](https://support.google.com/admob/answer/10113207?hl=en&ref_topic=10105230&sjid=6731900490614517032-AP)
You may need to [setup IDFA messages](https://support.google.com/admob/answer/10115027?hl=en), it will work along with GDPR messages and will show when users are not in EEA and UK.
Example of how to use UMP
```ts
import { AdMob, AdmobConsentStatus, AdmobConsentDebugGeography } from '@capacitor-community/admob';
async showConsent() {
const consentInfo = await AdMob.requestConsentInfo();
if (consentInfo.isConsentFormAvailable && consentInfo.status === AdmobConsentStatus.REQUIRED) {
const {status} = await AdMob.showConsentForm();
}
}
```
If you testing on real device, you have to set `debugGeography` and add your device ID to `testDeviceIdentifiers`. You can find your device ID with logcat (Android) or XCode (iOS).
```ts
const consentInfo = await AdMob.requestConsentInfo({
debugGeography: AdmobConsentDebugGeography.EEA,
testDeviceIdentifiers: ['YOUR_DEVICE_ID']
});
```
**Note**: When testing, if you choose not consent (Manage -> Confirm Choices). The ads may not load/show. Even on testing enviroment. This is normal. It will work on Production so don't worry.
### Show Banner

@@ -278,2 +306,5 @@

* [`addListener(BannerAdPluginEvents.AdImpression, ...)`](#addlistenerbanneradplugineventsadimpression-)
* [`requestConsentInfo(...)`](#requestconsentinfo)
* [`showConsentForm()`](#showconsentform)
* [`resetConsentInfo()`](#resetconsentinfo)
* [`prepareInterstitial(...)`](#prepareinterstitial)

@@ -516,2 +547,43 @@ * [`showInterstitial()`](#showinterstitial)

### requestConsentInfo(...)
```typescript
requestConsentInfo(options?: AdmobConsentRequestOptions) => Promise<AdmobConsentInfo>
```
Request user consent information
| Param | Type | Description |
| ------------- | --------------------------------------------------------------------------------- | --------------------- |
| **`options`** | <code><a href="#admobconsentrequestoptions">AdmobConsentRequestOptions</a></code> | ConsentRequestOptions |
**Returns:** <code>Promise&lt;<a href="#admobconsentinfo">AdmobConsentInfo</a>&gt;</code>
--------------------
### showConsentForm()
```typescript
showConsentForm() => Promise<AdmobConsentInfo>
```
Shows a google user consent form (rendered from your GDPR message config).
**Returns:** <code>Promise&lt;<a href="#admobconsentinfo">AdmobConsentInfo</a>&gt;</code>
--------------------
### resetConsentInfo()
```typescript
resetConsentInfo() => Promise<void>
```
Resets the UMP SDK state. Call requestConsentInfo function again to allow user modify their consent
--------------------
### prepareInterstitial(...)

@@ -825,2 +897,19 @@

#### AdmobConsentInfo
| Prop | Type | Description |
| ---------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------- |
| **`status`** | <code><a href="#admobconsentstatus">AdmobConsentStatus</a></code> | The consent status of the user. |
| **`isConsentFormAvailable`** | <code>boolean</code> | If `true` a consent form is available and vice versa. |
#### AdmobConsentRequestOptions
| Prop | Type | Description |
| ----------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **`debugGeography`** | <code><a href="#admobconsentdebuggeography">AdmobConsentDebugGeography</a></code> | Sets the debug geography to test the consent locally. |
| **`testDeviceIdentifiers`** | <code>string[]</code> | An array of test device IDs to allow. Note: On iOS, the ID may renew if you uninstall and reinstall the app. |
| **`tagForUnderAgeOfConsent`** | <code>boolean</code> | Set to `true` to provide the option for the user to accept being shown personalized ads. |
#### AdLoadInfo

@@ -923,2 +1012,21 @@

#### AdmobConsentStatus
| Members | Value | Description |
| ------------------ | --------------------------- | ------------------------------------------------------------------------------------- |
| **`NOT_REQUIRED`** | <code>'NOT_REQUIRED'</code> | User consent not required. |
| **`OBTAINED`** | <code>'OBTAINED'</code> | User consent already obtained. |
| **`REQUIRED`** | <code>'REQUIRED'</code> | User consent required but not yet obtained. |
| **`UNKNOWN`** | <code>'UNKNOWN'</code> | Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it. |
#### AdmobConsentDebugGeography
| Members | Value | Description |
| -------------- | -------------- | -------------------------------------------------- |
| **`DISABLED`** | <code>0</code> | Debug geography disabled. |
| **`EEA`** | <code>1</code> | Geography appears as in EEA for debug devices. |
| **`NOT_EEA`** | <code>2</code> | Geography appears as not in EEA for debug devices. |
#### InterstitialAdPluginEvents

@@ -925,0 +1033,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc