Is this correct...It showing only test ads but It's not showing real ads. I won't know whether the following method is correct or wrong for InterstitialAd.I've imported admob
package and configured AndroidManifest.xml as following.
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-############~#######"/>
Main.dart
static const MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
testDevices: testDevice != null ? <String>[testDevice] : null,
nonPersonalizedAds: true,
keywords: <String>['Game', 'Mario'],
);
InterstitialAd _interstitialAd;
@override
void initState() {
super.initState();
FirebaseAdMob.instance.initialize(appId:"ca-app-pub-##############~########");
}
@override
void dispose() {
_interstitialAd.dispose();
super.dispose();
}
InterstitialAd createInterstitialAd() {
return InterstitialAd(
adUnitId: "ca-app-pub-#############/#######",
//Change Interstitial AdUnitId with Admob ID
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("IntersttialAd $event");
});
}
Ad is triggered using button
onPressed:(){
createInterstitialAd()
..load()
..show();
}
You've setup test devices in your targetingInfo.
As long as all your ids from admob are from the console (production not test codes) then when this runs on actual devices other than the one you're testing on. It should work fine. It may take some time before actual ads get populated on a new app.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.