Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firebase_admob plugin displays smart banner at top instead of bottom #467

Closed
kroikie opened this issue Oct 13, 2019 · 3 comments
Closed
Labels
type: bug Something isn't working

Comments

@kroikie
Copy link
Collaborator

kroikie commented Oct 13, 2019

firebase_admob's show() method by default sets the anchorType to AnchorType.bottom. However, this setting isn't being honored on iOS 8, 9, and 10. iOS 11 and 12 appear to work fine.

About 10% of the time, it works as expected. 🤔

Steps to Reproduce

  1. Run the below sample code on iOS 8-10.
  2. The banner should be at the bottom.
  3. Instead, the banner is at the top.
import 'package:firebase_admob/firebase_admob.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  @override
  MainPageState createState() => MainPageState();
}

class MainPageState extends State<MainPage> {
  BannerAd _bannerAd;

  @override
  void initState() {
    super.initState();
    FirebaseAdMob.instance.initialize(appId: FirebaseAdMob.testAppId);
  }

  @override
  Widget build(BuildContext context) {
    _bannerAd ??= createBannerAd();
    _bannerAd..load()..show();
    return Container();
  }

  BannerAd createBannerAd() {
    return BannerAd(
      adUnitId: BannerAd.testAdUnitId,
      size: AdSize.smartBanner,
      listener: (MobileAdEvent event) {
        print('BannerAd event $event');
      },
    );
  }
}

Logs

[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.2 18C54, locale en-US)
    • Flutter version 1.0.0 at /Users/westy92/Source/flutter
    • Framework revision 5391447fae (8 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
 
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/westy92/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.
 
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.0.beta.2
 
[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 31.3.3
    • Dart plugin version 182.5124
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
 
[✓] VS Code (version 1.30.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.21.1
 
[✓] Connected device (1 available)
    • Seth's iPod touch • <redacted> • ios • iOS 9.3.5
 
• No issues found!

Below are simulators, in order: iOS 8.4, 9.3, 10.3.1, 11.4, 12.1.

image

@kroikie
Copy link
Collaborator Author

kroikie commented Oct 13, 2019

@westy92

The issue at flutter/flutter#27457 has been closed and moved here. Future collaboration on this issue will be done here.

@westy92
Copy link

westy92 commented Oct 13, 2019

@kroikie great! Just waiting for the fix to get merged. :)
#45

@iapicca iapicca added the type: bug Something isn't working label Oct 22, 2019
@iapicca
Copy link

iapicca commented Oct 24, 2019

Hi @westy92
I see there's an open issue addressing the case you described.
Please follow up on that issue,
I'm closing the current one as duplicate.
If you disagree please write in the comments
and I will reopen it.
Thank you

@iapicca iapicca closed this as completed Oct 24, 2019
@firebase firebase locked and limited conversation to collaborators Aug 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants