Skip to content

Commit 826fb41

Browse files
authored
docs: Update README with minimum gradle version (#23)
* Update README with minimum gradle plugin version. * Update gradle version in example app. * Update changelog. * Update pubspec version. * Address formatting issues for README. * Fix formatting and add references to the codelab in the README.
1 parent b67fddd commit 826fb41

File tree

6 files changed

+92
-77
lines changed

6 files changed

+92
-77
lines changed

README.md

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Get Started
1+
# Google Mobile Ads for Flutter
22

33
This guide is intended for publishers who want to monetize a [Flutter](https://flutter.dev/) app.
44

@@ -8,6 +8,8 @@ The Google Mobile Ads SDK for Flutter currently supports loading and displaying
88

99
Note: This plugin also contains support for **[Google Ad Manager](https://admanager.google.com/home/)**. If you are interested in creating and loading an Ad with Ad Manager, you may follow the same prerequisites, platform setup, mobile ads SDK initialization steps outlined in this doc, and see [creating and loading an ad with Ad Manager](https://github.com/googleads/googleads-mobile-flutter#creating-and-loading-an-ad-with-ad-manager) for further instructions.
1010

11+
See also the [codelab for inline ads in Flutter](https://codelabs.developers.google.com/codelabs/admob-inline-ads-in-flutter#0) for a detailed guide on setting
12+
inline banner and native ads.
1113

1214
## Prerequisites
1315

@@ -16,6 +18,7 @@ Note: This plugin also contains support for **[Google Ad Manager](https://admana
1618
* Android Studio 3.2 or higher
1719
* Target Android API level 19 or higher
1820
* Set `compileSdkVersion` to 28 or higher
21+
* Android Gradle Plugin 4.1 or higher (this is the version supported by Flutter out of the box)
1922
* Ios
2023
* Latest version of Xcode with [enabled command-line tools](https://flutter.dev/docs/get-started/install/macos#install-xcode).
2124
* Recommended: [Create an AdMob account](https://support.google.com/admob/answer/2784575) and [register an Android and/or iOS app](https://support.google.com/admob/answer/2773509)
@@ -31,8 +34,7 @@ Note: This plugin also contains support for **[Google Ad Manager](https://admana
3134
### iOS
3235

3336

34-
####
35-
Update your Info.plist
37+
#### Update your Info.plist
3638

3739
In your app's `ios/Runner/Info.plist` file, add a `GADApplicationIdentifier` key with a string value of your AdMob app ID ([identified in the AdMob UI](https://support.google.com/admob/answer/7356431)) as shown below:
3840

@@ -122,14 +124,16 @@ The Mobile Ads SDK is now imported and you're ready to implement an ad. AdMob of
122124
* Rewarded
123125
* Ads that reward users for watching short videos and interacting with playable ads and surveys. Good for monetizing free-to-play users.
124126

125-
#Banner Ads
127+
## Banner Ads
126128

127129
Banner ads occupy a spot within an app's layout, either at the top or bottom of the device screen. They stay on screen while users are interacting with the app, and can refresh automatically after a certain period of time.
128130

129131
This guide shows you how to integrate banner ads from AdMob into a Flutter app. In addition to code snippets and instructions, it also includes information about sizing banners properly and links to additional resources.
130132

133+
See also the [codelab for inline ads in Flutter](https://codelabs.developers.google.com/codelabs/admob-inline-ads-in-flutter#6) for a detailed guide on setting up banner ads.
131134

132-
## Always test with test ads
135+
136+
### Always test with test ads
133137

134138
When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account.
135139

@@ -141,7 +145,7 @@ The easiest way to load test ads is to use our dedicated test ad unit ID for ban
141145
It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.
142146

143147

144-
## Instantiate a Banner Ad
148+
### Instantiate a Banner Ad
145149

146150
A `BannerAd` requires an `adUnitId`, an `AdSize`, an `AdRequest`, and an `AdListener`. An example is shown below as well as more information on each parameter following.
147151

@@ -155,7 +159,7 @@ final BannerAd myBanner = BannerAd(
155159
);
156160
```
157161

158-
### Banner Sizes
162+
#### Banner Sizes
159163

160164
The table below lists the standard banner sizes.
161165

@@ -227,7 +231,7 @@ final AdSize adSize = AdSize(300, 50);
227231
```
228232

229233

230-
### Banner Ad Events
234+
#### Banner Ad Events
231235

232236
Through the use of `AdListener`, you can listen for lifecycle events, such as when an ad is closed or the user leaves the app. This example implements each method and logs a message to the console:
233237

@@ -249,7 +253,7 @@ final AdListener listener = AdListener(
249253
);
250254
```
251255

252-
## Load Banner Ad
256+
### Load Banner Ad
253257

254258
After a `BannerAd` is instantiated, `load()` must be called before it can be shown on the screen.
255259

@@ -258,7 +262,7 @@ After a `BannerAd` is instantiated, `load()` must be called before it can be sho
258262
myBanner.load();
259263
```
260264

261-
## Display a Banner Ad
265+
### Display a Banner Ad
262266

263267
To display a `BannerAd` as a widget, you must instantiate an `AdWidget` with a supported ad after calling `load()`. You can create the widget before calling `load()`, but `load()` must be called before adding it to the widget tree.
264268

@@ -285,14 +289,14 @@ Once an Ad has called `load()`, it must call `dispose()` when access to it is no
285289
That's it! Your app is now ready to display banner ads.
286290

287291

288-
# Interstitial Ad
292+
## Interstitial Ad
289293

290294
Interstitial ads are full-screen ads that cover the interface of their host app. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app.
291295

292296
This guide explains how to integrate interstitial ads into a Flutter app.
293297

294298

295-
## Always test with test ads
299+
### Always test with test ads
296300

297301
When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account.
298302

@@ -305,7 +309,7 @@ The easiest way to load test ads is to use our dedicated test ad unit ID for ban
305309
It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.
306310

307311

308-
## Instantiate an Interstitial Ad
312+
### Instantiate an Interstitial Ad
309313

310314
An `InterstitialAd` requires an `adUnitId`, an `AdRequest`, and an `AdListener`. An example is shown below as well as more information on each parameter following.
311315

@@ -318,7 +322,7 @@ final InterstitialAd myInterstitial = InterstitialAd(
318322
);
319323
```
320324

321-
### Interstitial Ad Events
325+
#### Interstitial Ad Events
322326

323327
Through the use of `AdListener`, you can listen for lifecycle events, such as when an ad is closed or the user leaves the app. This example implements each method and logs a message to the console:
324328

@@ -340,7 +344,7 @@ final AdListener listener = AdListener(
340344
);
341345
```
342346

343-
## Load Interstitial Ad
347+
### Load Interstitial Ad
344348

345349
After an `InterstitialAd` is instantiated, `load()` must be called before it can be shown on the screen.
346350

@@ -349,7 +353,7 @@ After an `InterstitialAd` is instantiated, `load()` must be called before it can
349353
myInterstitial.load();
350354
```
351355

352-
## Display an Interstitial Ad
356+
### Display an Interstitial Ad
353357

354358
An `InterstitialAd` is displayed as an Overlay on top of all app content and is statically placed. Which means it can not be added to the Flutter widget tree. You can choose when to show the add by calling `show()` after the ad is loaded.
355359

@@ -364,30 +368,32 @@ Once an ad has called `load()`, it must call `dispose()` when access to it is no
364368
That's it! Your app is now ready to display interstitial ads.
365369

366370

367-
## Next steps
371+
### Next steps
368372

369373

370374

371375
* See [Interstitial best practices](https://www.youtube.com/watch?v=r2RgFD3Apyo&index=5&list=PLOU2XLYxmsIKX0pUJV3uqp6N3NeHwHh0c) and [interstitial ad guidance](https://support.google.com/admob/answer/6066980).
372376
* Check out an [Interstitial ads case study](https://admob.google.com/home/resources/freaking-math-powers-revenue-increase-with-google-admob-support/).
373377
* If you haven't already, create your own interstitial ad unit in the [AdMob UI](https://apps.admob.com/).
374378

375-
# Native Ads
379+
## Native Ads
376380

377381

378382
Native ads are ad assets that are presented to users via UI components that are native to the platform. They're shown using the same types of views with which you're already building your layouts, and can be formatted to match the visual design of the user experience in which they live. In coding terms, this means that when a native ad loads, your app receives a NativeAd object that contains its assets, and the app (rather than the Google Mobile Ads SDK) is then responsible for displaying them.
379383

380384
Broadly speaking, there are two parts to successfully implementing Native Ads: loading an ad via the SDK and displaying the ad content in your app. This guide is concerned with using the SDK to load native ads.
381385

386+
See also the [codelab for inline ads in Flutter](https://codelabs.developers.google.com/codelabs/admob-inline-ads-in-flutter#7) for a detailed guide on setting up native ads.
387+
382388

383-
## Platform Setup
389+
### Platform Setup
384390

385391
Native Ads are presented to users via UI components that are native to the platform. (e.g. A [View](https://developer.android.com/reference/android/view/View) on Android or a [UIView](https://developer.apple.com/documentation/uikit/uiview?language=objc) on iOS).
386392

387393
Since Native Ads require UI components native to a platform, this feature requires additional setup for Android and iOS:
388394

389395

390-
### Android
396+
#### Android
391397

392398
The Android implementation of the Google Mobile Ads plugin requires a class that implements a NativeAdFactory. A `NativeAdFactory` contains a method that takes a [UnifiedNativeAd](https://developers.google.com/android/reference/com/google/android/gms/ads/formats/UnifiedNativeAd) and custom options and returns a [UnifiedNativeAdView](https://developers.google.com/android/reference/com/google/android/gms/ads/formats/UnifiedNativeAdView). The [UnifiedNativeAdView](https://developers.google.com/android/reference/com/google/android/gms/ads/formats/UnifiedNativeAdView) is what will be displayed in your app.
393399

@@ -486,7 +492,7 @@ class NativeAdFactoryExample implements NativeAdFactory {
486492
}
487493
```
488494

489-
### iOS
495+
#### iOS
490496

491497
The iOS implementation of the Google Mobile Ads plugin requires a class that implements a `FLTNativeAdFactory`. A `FLTNativeAdFactory` contains a method that takes a `GADUnifiedNativeAd` and custom options and returns a `GADUnifiedNativeAdView`. The `GADUnifiedNativeAdView` is what will be displayed in your app.
492498

@@ -586,7 +592,7 @@ When creating the `NativeAd` in Dart, the `factoryID` will need to match the one
586592
@end
587593
```
588594
589-
## Always test with test ads
595+
### Always test with test ads
590596
591597
When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account.
592598
@@ -598,7 +604,7 @@ The easiest way to load test ads is to use our dedicated test ad unit ID for ban
598604
It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.
599605
600606
601-
## Instantiate a Native Ad
607+
### Instantiate a Native Ad
602608
603609
A `NativeAd` requires an `adUnitId`, a `factoryId`, an `AdRequest`, and an `AdListener`. An example is shown below as well as more information on each parameter following.
604610
@@ -612,12 +618,12 @@ final NativeAd myNative = NativeAd(
612618
);
613619
```
614620

615-
### Factory Id
621+
#### Factory Id
616622

617623
The `factoryId` will need to match the one used to add the factory to `GoogleMobileAdsPlugin` on Android and/or the `FLTGoogleMobileAdsPlugin` on iOS. The same `factoryId` can be used by both platforms or each can have their own.
618624

619625

620-
### Native Ad Events
626+
#### Native Ad Events
621627

622628
Through the use of `AdListener`, you can listen for lifecycle events, such as when an ad is closed or the user leaves the app. This example implements each method and logs a message to the console:
623629

@@ -642,7 +648,7 @@ AdListener(
642648
);
643649
```
644650

645-
## Load Native Ad
651+
### Load Native Ad
646652

647653
After a `NativeAd` is instantiated, `load()` must be called before it can be shown on the screen.
648654

@@ -651,7 +657,7 @@ After a `NativeAd` is instantiated, `load()` must be called before it can be sho
651657
myNative.load();
652658
```
653659

654-
## Display a Native Ad
660+
### Display a Native Ad
655661

656662
To display a `NativeAd` as a widget, you must instantiate an `AdWidget` with a supported ad after calling `load()`. You can create the widget before calling `load()`, but `load()` must be called before adding it to the widget tree.
657663

@@ -676,19 +682,19 @@ Once an Ad has called `load()`, it must call `dispose()` when access to it is no
676682
That's it! Your app is now ready to display native ads.
677683

678684

679-
## Next steps
685+
### Next steps
680686

681687
* Learn more about native ads in our [native ad playbook](https://admob.google.com/home/resources/native-ads-playbook/).
682688
* See [native ads policies and guidelines](https://support.google.com/admob/answer/6329638) for implementing native ads.
683689
* Check out some customer success stories: [Case study 1](https://admob.google.com/home/resources/alarmmon-achieves-higher-rpm-with-admob-triggered-native-ads/), [Case Study 2](https://admob.google.com/home/resources/linghit-limited-doubles-ad-revenue-with-admob-native-ads/)
684690

685691

686-
# Rewarded Ads
692+
## Rewarded Ads
687693

688694
Rewarded ads are ads that users have the option of interacting with [in exchange for in-app rewards](https://support.google.com/admob/answer/7313578). This guide shows you how to integrate rewarded ads from AdMob into a Flutter app.
689695

690696

691-
## Always test with test ads
697+
### Always test with test ads
692698

693699
When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to suspension of your account.
694700

@@ -701,7 +707,7 @@ The easiest way to load test ads is to use our dedicated test ad unit ID for ban
701707
It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.
702708

703709

704-
## Instantiate a Rewarded Ad
710+
### Instantiate a Rewarded Ad
705711

706712
A `RewardedAd` requires an `adUnitId`, an `AdRequest`, and an `AdListener` with the `onRewardedAdUserEarnedReward` callback implemented. An example is shown below as well as more information on each parameter following.
707713

@@ -720,7 +726,7 @@ final RewardedAd myRewarded = RewardedAd(
720726
```
721727

722728

723-
### Rewarded Ad Events
729+
#### Rewarded Ad Events
724730

725731
Through the use of `AdListener`, you can listen for lifecycle events, such as when an ad is closed or the user leaves the app. This example implements each method and logs a message to the console:
726732

@@ -749,7 +755,7 @@ AdListener(
749755
Key Point: Make sure to implement the `onRewardedAdUserEarnedReward` event to
750756
reward the user for watching an ad.
751757

752-
## Load Rewarded Ad
758+
### Load Rewarded Ad
753759

754760
After a `RewardedAd` is instantiated, `load()` must be called before it can be shown on the screen.
755761

@@ -758,7 +764,7 @@ After a `RewardedAd` is instantiated, `load()` must be called before it can be s
758764
myRewarded.load();
759765
```
760766

761-
## Display a RewardedAd
767+
### Display a RewardedAd
762768

763769
A `RewardedAd` is displayed as an Overlay is displayed on top of all app content and is statically placed. Which means it can not be displayed this way can't be added to the Flutter widget tree. You can choose when to show the add by calling `show()` after the ad is loaded.
764770

@@ -774,11 +780,11 @@ Once an ad has called `load()`, it must call `dispose()` when access to it is no
774780
That's it! Your app is now ready to display rewarded ads.
775781

776782

777-
# Targeting
783+
## Targeting
778784

779785
The `RequestConfiguration` object collects the global configuration for every ad request and is applied by` MobileAds.instance.updateRequestConfiguration()`.
780786

781-
## Child-directed setting
787+
### Child-directed setting
782788

783789
For purposes of the [Children's Online Privacy Protection Act (COPPA)](https://www.ftc.gov/tips-advice/business-center/privacy-and-security/children%27s-privacy), there is a setting called "tag for child-directed treatment."
784790

@@ -797,7 +803,7 @@ final RequestConfiguration requestConfiguration = RequestConfiguration(
797803
MobileAds.instance.updateRequestConfiguration(requestConfiguration);
798804
```
799805

800-
## Users under the age of consent
806+
### Users under the age of consent
801807

802808
You can mark your ad requests to receive treatment for users in the European Economic Area (EEA) under the age of consent. This feature is designed to help facilitate compliance with the [General Data Protection Regulation (GDPR)](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679). Note that you may have other legal obligations under GDPR. Please review the European Union’s guidance and consult with your own legal counsel. Please remember that Google's tools are designed to facilitate compliance and do not relieve any particular publisher of its obligations under the law. [Learn more about how the GDPR affects publishers](https://support.google.com/admob/answer/7666366).
803809

@@ -819,7 +825,7 @@ MobileAds.instance.updateRequestConfiguration(requestConfiguration);
819825
The tags to enable the Child-directed setting and setTagForUnderAgeOfConsent should not both simultaneously be set to true. If they are, the child-directed setting takes precedence.
820826

821827

822-
## Ad Content Filtering
828+
### Ad Content Filtering
823829

824830
The setting can be set via` RequestConfiguration.maxAdContentRating()`:
825831

packages/google_mobile_ads/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* Set min Android version to `19`.
44
* Fixes bug that displayed "This AdWidget is already in the Widget tree".
5+
* Update minimum gradle version.
6+
* Add references to the [codelab](https://codelabs.developers.google.com/codelabs/admob-inline-ads-in-flutter#0) in the README.
57

68
## 0.11.0+1
79

0 commit comments

Comments
 (0)