You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more information about configuring the `Info.plist` and setting up your App ID, see [Update your Info.plist](https://developers.google.com/admob/ios/quick-start#update%5C_your%5C_infoplist).
@@ -89,7 +89,7 @@ Add AdMob App ID ([identified in the AdMob UI](https://support.google.com/admob/
@@ -128,7 +128,11 @@ Banner ads are rectangular ads that appear at the top or bottom of the device sc
128
128
129
129
#### Testing Banner ads in development mode
130
130
131
-
> **Note:** When developing your app, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account. Make sure you replace the test unit ID with your ad unit ID before publishing your app.
131
+
:::tip Note
132
+
133
+
When developing your app, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account. Make sure you replace the test unit ID with your ad unit ID before publishing your app.
134
+
135
+
:::
132
136
133
137
To enable dedicated test ad unit ID for banners, visit the links below:
134
138
@@ -151,17 +155,27 @@ The `BannerAd` requires the following attributes to be set:
@@ -217,8 +231,13 @@ And then add it to markup as follows. The `BannerAd` requires the following attr
217
231
-`BannerAdSize`: You can set this value in the callback function of the `layoutChanged` event. For more information, see [Customize the banner ad size](#customize-the-banner-ad-size)
- Set the `size` to any of the constants of the `BannerAdSize` class.
@@ -254,33 +271,32 @@ The table below lists the available constants and the sizes they represent.
254
271
The plugin enables you to listen to different lifecycle events of an ad, such as when an ad is loaded. Register the events handlers before calling the `load` method.
255
272
256
273
```ts
257
-
const bannerView =event.object;
274
+
const bannerView =event.object
258
275
259
276
// Called when an ad is successfully received.
260
-
bannerView.on('adLoaded', (args) =>{
261
-
console.log('Ad loaded.'),
262
-
});
263
-
264
-
// Called when an ad request failed.
265
-
bannerView.on('adFailedToLoad', (args) =>{
266
-
console.log('Ad failed to load: ', args.error);
267
-
});
277
+
bannerView.on('adLoaded', args=> {
278
+
console.log('Ad loaded.')
279
+
})
268
280
269
-
// Called when the user removes an overlay that covers the screen.
270
-
bannerView.on('adClosed', (args)=>{
271
-
console.log('Ad closed.');
272
-
});
281
+
// Called when an ad request failed.
282
+
bannerView.on('adFailedToLoad', args=>{
283
+
console.log('Ad failed to load: ', args.error)
284
+
})
273
285
274
-
// Called when an impression occurs on the ad.
275
-
bannerView.on('adImpression', (args)=>{
276
-
console.log('Ad impression.');
277
-
});
286
+
// Called when the user removes an overlay that covers the screen.
287
+
bannerView.on('adClosed', args=>{
288
+
console.log('Ad closed.')
289
+
})
278
290
279
-
// Called when an tap/touch/click occurs on the ad.
280
-
bannerView.on('adClicked', (args)=>{
281
-
console.log('Ad tapped');
282
-
});
291
+
// Called when an impression occurs on the ad.
292
+
bannerView.on('adImpression', args=>{
293
+
console.log('Ad impression.')
294
+
})
283
295
296
+
// Called when an tap/touch/click occurs on the ad.
297
+
bannerView.on('adClicked', args=> {
298
+
console.log('Ad tapped')
299
+
})
284
300
```
285
301
286
302
### Display a banner ad to the user
@@ -297,8 +313,12 @@ Interstitial ads are full-screen ads that cover the interface of an app until cl
297
313
298
314
#### Testing Interstitial ads in development
299
315
300
-
> **Note:** When your app is in development mode, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account. Make sure you replace the test unit ID with your ad unit ID before publishing your app.
301
-
> To enable dedicated test ad unit ID, visit the links below:
316
+
:::tip Note
317
+
318
+
When your app is in development mode, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account. Make sure you replace the test unit ID with your ad unit ID before publishing your app.
319
+
To enable dedicated test ad unit ID, visit the links below:
const ad =InterstitialAd.createForAdRequest('ca-app-pub-3940256099942544/4411468910')
402
+
403
+
const ad =InterstitialAd.createForAdRequest('ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy')
381
404
382
405
ad.onAdEvent((event, error, data) => {
383
406
switch (event) {
@@ -415,7 +438,7 @@ To add a Native ad to your {N} Core app, follow these steps:
415
438
1. Register the plugin namespace under a prefix, `ui` (this can be any name), with the Page element.
416
439
417
440
```xml
418
-
<Pagexmlns:ui="@nativescript/firebase-admob" />
441
+
<Pagexmlns:ui="@nativescript/firebase-admob">
419
442
```
420
443
421
444
2. Use the prefix to access the `NativeAdView` and add it to markup.
@@ -431,7 +454,11 @@ To add a Native ad to your {N} Core app, follow these steps:
431
454
432
455
### Testing Native ads in development mode
433
456
434
-
> **Note:** When developing your app, make sure you use test ad unit IDs rather than live, production ads. Failure to do so can lead to suspension of your account. Just make sure you replace the test ad unit ID with your own ad unit ID before publishing your app.
457
+
:::tip Note
458
+
459
+
When developing your app, make sure you use test ad unit IDs rather than live, production ads. Failure to do so can lead to suspension of your account. Just make sure you replace the test ad unit ID with your own ad unit ID before publishing your app.
460
+
461
+
:::
435
462
436
463
To enable dedicated test ad unit ID, visit the links below:
437
464
@@ -450,7 +477,7 @@ The `NativeAdLoader` class is an interface for managing the the Native ad.
450
477
Create an instance of `NativeAdLoader` by calling its constructor function. The constructor function accepts 3 parameters. The required adUnitId as the first parameter, optional RequestOptions and NativeAdOptions objects as the second and third parameter, respectively.
A NativeAdOptions object is used to set the following options on the native ad.
511
-
| Property | Type | Description
512
-
|:---------|:-----|:-----------
513
-
| `returnUrlsForImageAssets` | `boolean` | _Optional_: If set to `true`, the SDK will not load image asset content and native ad image URLs can be used to fetch content. Defaults to `false`.
514
-
| `multipleImages` | `boolean`| _Optional_: Some image assets contain a series of images. Setting this property to `true` tells the app to display all the images of an asset. The `false`(the default) value informs the app to display the first image from the series of images in an image asset.
515
-
| `adChoicesPlacement` | [AdChoicesPlacement](#adchoicesplacement) |_Optional_: The [AdChoices overlay](https://developers.google.com/admob/android/native/advanced#adchoices_overlay) is set to the top right corner by default. Apps can change which corner this overlay is rendered in by setting this property to one of the following:
516
-
| `videoOptions` | [videoOptions](#videooptions)| _Optional_: Used to set video options for video assets returned as part of a native ad. If an ad contains a video(if `ad.mediaContent.hasVideoContent = true`), display the video.
539
+
| Property | Type | Description|
540
+
|:---------|:-----|:-----------|
541
+
|`returnUrlsForImageAssets`|`boolean`|_Optional_: If set to `true`, the SDK will not load image asset content and native ad image URLs can be used to fetch content. Defaults to `false`.|
542
+
|`multipleImages`|`boolean`|_Optional_: Some image assets contain a series of images. Setting this property to `true` tells the app to display all the images of an asset. The `false`(the default) value informs the app to display the first image from the series of images in an image asset.|
543
+
|`adChoicesPlacement`|[AdChoicesPlacement](#adchoicesplacement)|_Optional_: The [AdChoices overlay](https://developers.google.com/admob/android/native/advanced#adchoices_overlay) is set to the top right corner by default. Apps can change which corner this overlay is rendered in by setting this property to one of the following:|
544
+
|`videoOptions`|[videoOptions](#videooptions)|_Optional_: Used to set video options for video assets returned as part of a native ad. If an ad contains a video(if `ad.mediaContent.hasVideoContent = true`), display the video.|
517
545
| `mediaAspectRatio` | [MediaAspectRatio](#mediaaspectratio) | _Optional_: This sets the aspect ratio for image or video to be returned for the native ad.
518
546
519
547
#### AdChoicesPlacement
@@ -530,11 +558,11 @@ enum AdChoicesPlacement {
530
558
#### videoOptions
531
559
532
560
The `videoOptions` property is an object with the following properties:
533
-
| Property | Type | Optional
534
-
|:---------|:----|:-------
535
-
| `startMuted` | `boolean` | _Yes_
536
-
| `clickToExpandRequested` | `boolean` | _Yes_
537
-
| `customControlsRequested` | `boolean` | _Yes_
561
+
| Property | Type | Optional|
562
+
|:---------|:----|:-------|
563
+
|`startMuted`|`boolean`|_Yes_|
564
+
|`clickToExpandRequested`|`boolean`|_Yes_|
565
+
|`customControlsRequested`|`boolean`|_Yes_|
538
566
539
567
#### MediaAspectRatio
540
568
@@ -561,7 +589,11 @@ Rewarded ads are ads that users have the option of interacting with [in exchange
561
589
562
590
### Testing Rewarded ads in development mode
563
591
564
-
> **Note:** When developing your app, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account. Make sure you replace the test unit ID with your ad unit ID before publishing your app.
592
+
:::tip Note
593
+
594
+
When developing your app, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account. Make sure you replace the test unit ID with your ad unit ID before publishing your app.
595
+
596
+
:::
565
597
566
598
To enable dedicated test ad unit ID, visit the links below:
567
599
@@ -584,15 +616,17 @@ Create a Rewarded ad instance by calling the `createForAdRequest` static method
0 commit comments