firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

[firebase_admob] Missing steps in the doc leads to Test Device IDs are not printed to the console for iOS #2978

Closed tapizquent closed 3 years ago

tapizquent commented 4 years ago

Describe the bug While trying to set AdMob along with my own AdUnits, I realized the device IDs are not printed to the console as the documentation says.

To Reproduce Steps to reproduce the behavior:

  1. Go to a project with AdMob properly set up
  2. Run the project with AbMob initialized as firebase_admob package explains
  3. See error or incorrect behavior

Expected behavior The console should print the device's test ID as the documentation explains.

Additional context I have tried building the app in Xcode, and not on VS Code as I usually build my apps, but no device test id there either.

Flutter doctor Run flutter doctor and paste the output below:

[✓] Flutter (Channel beta, 1.19.0-4.3.pre, on Mac OS X 10.15.6 19G73, locale en-US)
    • Flutter version 1.19.0-4.3.pre at /Users/josetapizquent/Projects/Tools/flutter
    • Framework revision 8fe7655ed2 (2 weeks ago), 2020-07-01 14:31:18 -0700
    • Engine revision 9a28c3bcf4
    • Dart version 2.9.0 (build 2.9.0-14.1.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/josetapizquent/Library/Android/sdk
    • Platform android-29, build-tools 29.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_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Users/josetapizquent/SSDrive/Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.47.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.12.2

[✓] Connected device (2 available)
    • PH 1     • PM1LHMA832905735          • android-arm64 • Android 10 (API 29)
    • TapPhone • 00008020-000E58220E99002E • ios           • iOS 13.5.1

• No issues found!
TahaTesser commented 4 years ago

Hi @tapizquent Can you please try official example and make sure to include app id setup

Running official example i can print Test Device IDs in the console using firebase_admob: ^0.9.3+2

I/Ads     ( 4871): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("<remove test id>") to get test ads on this device.
flutter doctor -v ``` [✓] Flutter (Channel dev, 1.21.0-1.0.pre, on Mac OS X 10.15.6 19G73, locale en-GB) • Flutter version 1.21.0-1.0.pre at /Users/taha/Code/flutter_dev • Framework revision f25bd9c55c (6 days ago), 2020-07-14 20:26:01 -0400 • Engine revision 99c2b3a245 • Dart version 2.9.0 (build 2.9.0-21.0.dev 20bf2fcf56) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at /Users/taha/Code/sdk • Platform android-29, build-tools 29.0.3 • ANDROID_HOME = /Users/taha/Code/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.6) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.6, Build version 11E708 • CocoaPods version 1.9.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.0) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 47.1.2 • Dart plugin version 193.7361 • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) [✓] VS Code (version 1.47.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.12.2 [✓] Connected device (5 available) • SM M305F (mobile) • 32003c30dc19668f • android-arm64 • Android 10 (API 29) • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios • iOS 13.6 • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.6 19G73 • Web Server (web) • web-server • web-javascript • Flutter Tools • Chrome (web) • chrome • web-javascript • Google Chrome 83.0.4103.116 • No issues found! ```
tapizquent commented 4 years ago

I was able to get it to work.

I believe some key steps are missing from the documentation on the package page.

Before making it work, I had to do a couple stuff.

1 - Link Firebase Project to AdMob and had to re-download the GoogleService-Info.plist.

2 - Go into settings in my iPhone and disable Limit Ad Tracking.

Once all this was done, I had to actually click on an ad, and then it actually printed the a ID.

I believe all this should be better explained in the docs.

russellwheatley commented 3 years ago

The firebase_admob plugin will be deprecated in April 2021 in favor of Google Mobile Ads SDK for Flutter. Google Mobile Ads SDK for Flutter is a new Flutter plugin that supports more Ads formats than firebase_admob does. Google Mobile Ads SDK for Flutter currently supports loading and displaying banner, interstitial (full-screen), native ads, and rewarded video ads across AdMob and AdManager. It also supports displaying banner and native ads as Widgets as opposed to being overlayed over all app content. We're now recommending projects currently using firebase_admob migrate to Google Mobile Ads SDK for Flutter following the instructions outlined here. Issues with migrating or with using the new package should now be raised over on the Google Mobile Ads SDK for Flutter repository.