Closed desmeit closed 1 year ago
Hi @desmeit, please provide a completed and minimal reproducible code sample so that we may verify this. Also, please provide the output of flutter doctor -v
as well.
Thank you!
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
class AdaptiveBannerAd extends StatefulWidget {
const AdaptiveBannerAd({Key key}) : super(key: key);
@override
State<AdaptiveBannerAd> createState() => _AdaptiveBannerAdState();
}
class _AdaptiveBannerAdState extends State<AdaptiveBannerAd> {
String get bannerAdUnitId {
/// Always test with test ads
if (kDebugMode) {
//return MobileAds.bannerAdTestUnitId;
return 'ca-app-pub-3940256099942544/6300978111';
} else {
if (Platform.isIOS) {
return 'XXX';
} else if (Platform.isAndroid) {
return 'XXX';
}
}
}
BannerAd _bannerAd;
bool _isBannerLoaded = false;
AnchoredAdaptiveBannerAdSize size;
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
_initBannerAd();
}
Future<AnchoredAdaptiveBannerAdSize> anchoredAdaptiveBannerAdSize(
BuildContext context) async {
// Used to set size of adaptive banner ad according to device width and orientation.
return await AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(
MediaQuery.of(context).size.width.toInt());
}
_initBannerAd() async {
size = await anchoredAdaptiveBannerAdSize(context);
print("anchoredAdaptiveBannerAdSize size: " + size.toString());
_bannerAd = BannerAd(
size: size,
adUnitId: bannerAdUnitId,
listener: BannerAdListener(
onAdLoaded: (ad) {
setState(() {
_isBannerLoaded = true;
});
},
onAdFailedToLoad: (ad, error) {},
),
request: AdRequest(),
);
_bannerAd.load();
}
@override
Widget build(BuildContext context) {
return _isBannerLoaded
? Container(
height: size.height.toDouble(),
width: size.width.toDouble(),
child: AdWidget(ad: _bannerAd))
: SizedBox();
}
}
flutter doctor -v
[✓] Flutter (Channel stable, 2.10.5, on macOS 11.6.5 20G527 darwin-x64, locale de-DE)
• Flutter version 2.10.5 at /Users/XXX/development/tools/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (4 months ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/XXX/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/XXX/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/XXX/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.69.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.46.0
Hi @desmeit For the issue to be workable, it needs to be reproducible with a completed and minimal reproducible code sample. Please provide such a sample. Thank you!
I have created a minimal app. Please change GADApplicationIdentifier to show the ads.
When I open the bottom sheet and click on the ElevatedButton on the bottom, it should actually output "enter value". It does but it additionally triggers the ad and opens the Safari browser. this should only happen if I click directly on the ad, not on the button of the overlaid bottom sheet. I tested only IOS so far. Some ads show the problem, some don't. Unfortunately, the test ad cannot reproduce it:
I used the test ad ca-app-pub-3940256099942544/6300978111
in the example. Here the issue does not occur. The issue occurs only in Production Mode, when an animated ad comes. An example was an ad from Consors Bank with the link "https://aktionen.consorsbank.de/ev/tagesgeld/?partnerId=DI5adl&aid=di000085&cid=DIS-234".
Does this answer your questions? If there are further questions, please ask.
Here you find the app: https://we.tl/t-Nl3d9VrdLb
Thanks for your help!
Hi @desmeit, thanks for providing the sample code.
But I can not reproduce the issue on the latest stable
and master
channels with test ad IDs (same as you). I also tried with the latest ads version: google_mobile_ads: ^2.0.1
but the result is still the same.
When clicking on the button, the banner ad does not respond.
As I can see from the sample code, you're using the old plugin version: google_mobile_ads: ^1.2.0
. Could you please try upgrading to the latest version (2.0.1
) and try reproducing the issue again in Production Mode?
Hi @huycozy I cannot switch to 2.0.1 because I'm using 2.10.5 flutter version. As I said the issue occurs only with some specific ads, for example the consorsbank ad.
please see the screencast in addition. here you can see whats happen if I click on my button on the bottom: https://we.tl/t-IzivvIS9Wg it triggers the ad.
@desmeit thank you so much for providing the demo video in production mode. Labeling this issue for further investigation from the team!
I'm having the same issue.
The banner ad behind the bottomsheet, responds the click action.
This issue does not comply with admob policies and is very bad in terms of user experience.
The issue occurs in ios production mode.
I am using the latest version: google_mobile_ads: ^2.2.0
For me the bug appeared only with version 2.3.0 of the package. Version 2.2.0 was fine. Now if I click on the bottom nav bar and there is a banner behind it, it clicks on the banner and not the bottom nav bar. Just on iOS. I'm on Flutter 3.3.8
Thank you.
We see the same issue within our App for certain ads within a medium rectangle banner. Users are thinking we open magical some weird web pages. Any news?
flutter: 3.3.10
google_mobile_ads: 2.4.0
@DavideM12 @desmeit could you solve this issue on your own?
@huycozy - do we have a reproducible sample or just a video for this issue?
@timothyhoang-google:
@desmeit and I also couldn't reproduce this issue with test ads. Per https://github.com/googleads/googleads-mobile-flutter/issues/629#issuecomment-1216810081 and https://github.com/googleads/googleads-mobile-flutter/issues/629#issuecomment-1220728294, the bug only occurs with production and specific ad content.
@desmeit Your demo video in link above is expired, can you please share it here again? (attaching raw video to GitHub comment, to make sure it will not be expired)
Can anyone please have a look on this issue? I'm having it with my app when displaying production ads. Cannot provide reproducible code sample as the code for ads config is strictly confidential. But here's a recording, the ad is opened even when I tapped on pink area (which is a modal bottom sheet)https://github.com/googleads/googleads-mobile-flutter/assets/66512171/0c9f08c2-67d9-429e-b4a1-677f7f03fd62
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.
Isn't showing an overlay like (bottom sheet navigator) over an ad content against Google Ads / Admob policies?
@desmeit Did you resolve this issue? Please guide us!
I use a banner. In certain cases, a bottom sheet opens and overlays the banner. In the Bottom Sheet there is a button at the bottom, which is at the same position as the banner. When I click on the button, the link of the banner opens safari instead of the button responding.
How can I stop this behavior? I tried
useRootNavigator: true,
withinshowModalBottomSheet
but it is not working.google_mobile_ads: 1.2.0