flutter_google_ad_manager
Flutter plugin for Google Ad Manager(DoubleClick for Publishers).
Getting Started
ios
Add io.flutter.embedded_views_preview
in info.plist
<key>io.flutter.embedded_views_preview</key>
<true/>
Follow any additional instructions found here
Google Ad Manager Getting Started Guide
Android
Add com.google.android.gms.ads.AD_MANAGER_APP
in AndroidManifest.xml
<manifest>
<application>
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
</manifest>
Follow any additional instructions found here
Google Ad Manager Getting Started Guide
Banner Ads
Just write the DFPBanner
widget in your favorite place.
Manual Ad Refresh
You can manually refresh the banner ads on user interaction, use the onAdViewCreated
callback to save an instance of the DFPBannerViewController and then call the reload() method to refresh the ad.
About testDevices
If you set isDevelop
to true, the test adUnitId will be used.
( If set false, the described adUnitId
is used.)
Google Ad Manger needs to register testDevices
in case of actual devices.
With this plug-in, you can create the following class and set it to testDevices of DFPBanner.
DFPBanner(
testDevices: MyTestDevices(),
)
About adSize
DFPAdSize
is available. This is the same size as that of android.
- BANNER
- FULL_BANNER
- LARGE_BANNER
- LEADERBOARD
- MEDIUM_RECTANGLE
- SMART_BANNER (Only Portrait)
Other custom is also available.
const DFPAdSize.custom({double width, double height})
.
About EventListener
The following event listeners are available:
- onAdLoaded
- onAdFailedToLoad
- onAdOpened
- onAdClosed
- onAdLeftApplication
Interstitial Ads
Firstly load
it and call the show
method at the desired timing.
await interstitialAd.show();
About isDevelop
If you set isDevelop
to true, the test adUnitId will be used.
( If set false, the described adUnitId
is used.)
About EventListener
The following event listeners are available:
- onAdLoaded
- onAdFailedToLoad
- onAdOpened
- onAdClosed
- onAdLeftApplication
Rewarded Ads
firstly load
it and call the show
method at the desired timing.
It is necessary to call it when resumed
and paused
, respectively.
For that, please implement WidgetsBindingObserver.
About isDevelop
If you set isDevelop
to true, the test adUnitId will be used.
( If set false, the described adUnitId
is used.)
About EventListener
The following event listeners are available:
- onAdLoaded
- onAdFailedToLoad
- onAdOpened
- onAdClosed
- onAdLeftApplication
- onRewarded
- onVideoStarted
- onVideoCompleted
Native Ads
Not implemented.
I am glad if someone will give me a pull request.