Socket
Socket
Sign inDemoInstall

@capacitor-community/admob

Package Overview
Dependencies
Maintainers
14
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 1.0.1 to 1.1.0

android/.idea/caches/build_file_checksums.ser

2

package.json
{
"name": "@capacitor-community/admob",
"version": "1.0.1",
"version": "1.1.0",
"description": "A native plugin for AdMob",

@@ -5,0 +5,0 @@ "main": "dist/esm/index.js",

@@ -26,5 +26,7 @@ [![npm version](https://badge.fury.io/js/%40capacitor-community%2Fadmob.svg)](https://badge.fury.io/js/%40capacitor-community%2Fadmob)

## Installation
__Supporting iOS14 is be since @1.1.0.__
```
$ npm install --save @capacitor-community/admob
% npm install --save @capacitor-community/admob
% npx cap update
```

@@ -34,3 +36,4 @@

```
$ npm install --save @rdlabo/capacitor-admob@0.3.0
% npm install --save @rdlabo/capacitor-admob@0.3.0
% npx cap update
```

@@ -42,8 +45,8 @@

```diff
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
[...]
+ add(com.getcapacitor.community.admob.AdMob.class);
[...]
}});
```java
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
[...]
add(com.getcapacitor.community.admob.AdMob.class);
[...]
}});
```

@@ -53,6 +56,6 @@

```diff
+ <meta-data
+ android:name="com.google.android.gms.ads.APPLICATION_ID"
+ android:value="@string/admob_app_id"/>
```xml
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="@string/admob_app_id"/>
```

@@ -62,4 +65,4 @@

```diff
+ <string name="admob_app_id">[APP_ID]</string>
```xml
<string name="admob_app_id">[APP_ID]</string>
```

@@ -71,28 +74,15 @@

## iOS configuration
Add the following in the `ios/App/App/info.plist` file inside of the outermost `<dict>`:
In file `ios/App/App/AppDelegate.swift` add or replace the following:
```xml
<key>GADIsAdManagerApp</key>
<true/>
```diff
+ import GoogleMobileAds
<key>GADApplicationIdentifier</key>
<string>[APP_ID]</string>
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
+ GADMobileAds.sharedInstance().start(completionHandler: nil)
<key>NSUserTrackingUsageDescription</key>
<string>[Why you use NSUserTracking. ex: This identifier will be used to deliver personalized ads to you.]</string>
```
Add the following in the `ios/App/App/info.plist` file:
```diff
+ <key>GADIsAdManagerApp</key>
+ <true/>
+ <key>GADApplicationIdentifier</key>
+ <string>[APP_ID]</string>
```
Don't forget to replace `[APP_ID]` by your AddMob application Id.

@@ -106,16 +96,16 @@

```ts
+ import { Plugins } from '@capacitor/core';
+ const { AdMob } = Plugins;
import { Plugins } from '@capacitor/core';
const { AdMob } = Plugins;
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
constructor(){
// Initialize AdMob for your Application
+ AdMob.initialize();
}
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
constructor() {
// Initialize AdMob for your Application
AdMob.initialize();
}
}
```

@@ -128,43 +118,43 @@

```ts
import React from 'react';
import { Redirect, Route } from 'react-router-dom';
import { IonApp, IonRouterOutlet, isPlatform } from '@ionic/react';
import { IonReactRouter } from '@ionic/react-router';
import Home from './pages/Home';
import React from 'react';
import { Redirect, Route } from 'react-router-dom';
import { IonApp, IonRouterOutlet, isPlatform } from '@ionic/react';
import { IonReactRouter } from '@ionic/react-router';
import Home from './pages/Home';
+ import { Plugins } from '@capacitor/core';
+ import { AdOptions, AdSize, AdPosition } from '@capacitor-community/admob';
+ const { AdMob } = Plugins;
import { Plugins } from '@capacitor/core';
import { AdOptions, AdSize, AdPosition } from '@capacitor-community/admob';
const { AdMob } = Plugins;
const App: React.FC = () => {
const App: React.FC = () => {
+ AdMob.initialize();
+
+ const adId = {
+ ios: 'ios-value-here',
+ android: 'android-value-here'
+ }
+
+ const platformAdId = isPlatform('android') ? adId.android : adId.ios;
+
+ const options: AdOptions = {
+ adId: platformAdId,
+ adSize: AdSize.BANNER,
+ position: AdPosition.BOTTOM_CENTER,
+ margin: 0,
+ // isTesting: true
+ }
+
+ AdMob.showBanner(options);
+
+ // Subscibe Banner Event Listener
+ AdMob.addListener('onAdLoaded', (info: boolean) => {
+ console.log("Banner ad loaded");
+ });
+
+ // Get Banner Size
+ AdMob.addListener('onAdSize', (info: boolean) => {
+ console.log(info);
+ });
AdMob.initialize();
const adId = {
ios: 'ios-value-here',
android: 'android-value-here'
}
const platformAdId = isPlatform('android') ? adId.android : adId.ios;
const options: AdOptions = {
adId: platformAdId,
adSize: AdSize.BANNER,
position: AdPosition.BOTTOM_CENTER,
margin: 0,
// isTesting: true
}
AdMob.showBanner(options);
// Subscibe Banner Event Listener
AdMob.addListener('onAdLoaded', (info: boolean) => {
console.log("Banner ad loaded");
});
// Get Banner Size
AdMob.addListener('onAdSize', (info: boolean) => {
console.log(info);
});
return (

@@ -194,35 +184,35 @@ <IonApp>

```ts
+ import { Plugins } from '@capacitor/core';
+ import { AdOptions, AdSize, AdPosition } from '@capacitor-community/admob';
+ const { AdMob } = Plugins;
import { Plugins } from '@capacitor/core';
import { AdOptions, AdSize, AdPosition } from '@capacitor-community/admob';
const { AdMob } = Plugins;
@Component({
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss']
})
export class AdMobComponent {
@Component({
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss']
})
export class AdMobComponent {
+ private options: AdOptions = {
+ adId: 'YOUR ADID',
+ adSize: AdSize.BANNER,
+ position: AdPosition.BOTTOM_CENTER,
+ margin: 0,
+ }
private options: AdOptions = {
adId: 'YOUR ADID',
adSize: AdSize.BANNER,
position: AdPosition.BOTTOM_CENTER,
margin: 0,
}
constructor(){
+ // Show Banner Ad
+ AdMob.showBanner(this.options);
+
+ // Subscibe Banner Event Listener
+ AdMob.addListener('onAdLoaded', (info: boolean) => {
+ console.log("Banner Ad Loaded");
+ });
+
+ // Get Banner Size
+ AdMob.addListener('onAdSize', (info: boolean) => {
+ console.log(info);
+ });
+ }
}
constructor() {
// Show Banner Ad
AdMob.showBanner(this.options);
// Subscibe Banner Event Listener
AdMob.addListener('onAdLoaded', (info: boolean) => {
console.log("Banner Ad Loaded");
});
// Get Banner Size
AdMob.addListener('onAdSize', (info: boolean) => {
console.log(info);
});
}
}
```

@@ -268,28 +258,28 @@

```ts
+ import { Plugins } from '@capacitor/core';
+ import { AdOptions } from '@rdlabo/capacitor-admob';
+ const { AdMob } = Plugins;
import { Plugins } from '@capacitor/core';
import { AdOptions } from '@rdlabo/capacitor-admob';
const { AdMob } = Plugins;
@Component({
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss']
})
export class AppComponent {
+ const options: AdOptions = {
+ adId: 'YOUR ADID',
+ autoShow: false
+ }
@Component({
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss']
})
export class AppComponent {
const options: AdOptions = {
adId: 'YOUR ADID',
autoShow: false
}
constructor(){
+ // Prepare interstitial banner
+ AdMob.prepareInterstitial(this.options);
+
+ // Subscibe Banner Event Listener
+ AdMob.addListener('onAdLoaded', (info: boolean) => {
+ // You can call showInterstitial() here or anytime you want.
+ console.log("Interstitial Ad Loaded");
+ });
}
}
constructor(){
// Prepare interstitial banner
AdMob.prepareInterstitial(this.options);
// Subscibe Banner Event Listener
AdMob.addListener('onAdLoaded', (info: boolean) => {
// You can call showInterstitial() here or anytime you want.
console.log("Interstitial Ad Loaded");
});
}
}
```

@@ -321,27 +311,27 @@

```ts
+ import { Plugins } from '@capacitor/core';
+ import { AdOptions } from '@rdlabo/capacitor-admob';
+ const { AdMob } = Plugins;
import { Plugins } from '@capacitor/core';
import { AdOptions } from '@rdlabo/capacitor-admob';
const { AdMob } = Plugins;
@Component({
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss']
})
export class AdMobComponent {
+ const options: AdOptions = {
+ adId: 'YOUR ADID'
+ }
@Component({
selector: 'admob',
templateUrl: 'admob.component.html',
styleUrls: ['admob.component.scss']
})
export class AdMobComponent {
const options: AdOptions = {
adId: 'YOUR ADID'
}
constructor(){
+ // Prepare ReWardVideo
+ AdMob.prepareRewardVideoAd(this.options);
+
+ // Subscibe ReWardVideo Event Listener
+ AdMob.addListener('onRewardedVideoAdLoaded', (info: boolean) => {
+ // You can call showRewardVideoAd() here or anytime you want.
+ console.log("RewardedVideoAd Loaded");
+ });
}
}
constructor(){
// Prepare ReWardVideo
AdMob.prepareRewardVideoAd(this.options);
// Subscibe ReWardVideo Event Listener
AdMob.addListener('onRewardedVideoAdLoaded', (info: boolean) => {
// You can call showRewardVideoAd() here or anytime you want.
console.log("RewardedVideoAd Loaded");
});
}
}
```

@@ -427,3 +417,13 @@

## TROUBLE SHOOTING
### If you have error:
> [error] Error running update: Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "Google-Mobile-Ads-SDK":
You should run `pod repo update` ;
## License
Capacitor AdMob is [MIT licensed](./LICENSE).

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