the native ad is me show a an error. I use the Test ad id from google.
"This ad may have not been loaded or has been disposed. Ad with the following id could not be found:1"
Can anyone help me?
EDIT #1 My Code There are a different example codes for native Ad? I use google_mobile_ads: ^0.13.2
...
class _GameState extends State<Game> {
static const AdRequest targetingInfo = AdRequest(
);
static const int maxFailedLoadAttempts = 3;
static const _adUnitIDNative = "ca-app-pub-3940256099942544/2247696110";
late StreamSubscription _subscription;
bool? _deutsch;
final NativeAd myNative = NativeAd(
adUnitId: _adUnitIDNative,
factoryId: 'listTile',
request: AdRequest(),
listener: NativeAdListener(),
);
final NativeAdListener listener = NativeAdListener(
// Called when an ad is successfully received.
onAdLoaded: (Ad ad) => print('Ad loaded.'),
// Called when an ad request failed.
onAdFailedToLoad: (Ad ad, LoadAdError error) {
// Dispose the ad here to free resources.
ad.dispose();
print('NativeAd failed to load: $error');
},
// Called when an ad opens an overlay that covers the screen.
onAdOpened: (Ad ad) => print('Ad opened.'),
// Called when an ad removes an overlay that covers the screen.
onAdClosed: (Ad ad) => print('Ad closed.'),
// Called when an impression occurs on the ad.
onAdImpression: (Ad ad) => print('Ad impression.'),
// Called when a click is recorded for a NativeAd.
onNativeAdClicked: (NativeAd ad) => print('Ad clicked.'),
);
get adContainer => null;
@override
void initState() {
super.initState();
_createInterstitialAd();
myNative.load();
}
...
Container(
alignment: Alignment.center,
child: AdWidget(ad: myNative),
padding: EdgeInsets.all(10),
margin: EdgeInsets.only(bottom: 20.0),
height: 70,
),
Thanks
