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

App Tracking Transparency dialog not appearing in iOS 15.5 #660

Closed
omatt opened this issue Oct 5, 2022 · 12 comments
Closed

App Tracking Transparency dialog not appearing in iOS 15.5 #660

omatt opened this issue Oct 5, 2022 · 12 comments
Labels
feedback required Further information is requested in triage Issue currently being evaluated

Comments

@omatt
Copy link

omatt commented Oct 5, 2022

Plugin Version

google_mobile_ads: ^2.0.1

Steps to Reproduce

  1. Use example provided in google_mobile_ads
  2. Follow this guide to display ATT dialog in iOS 15.5
  3. Add requestConsentInfoUpdate() on initState() and update Info.plist with NSUserTrackingUsageDescription
@override
  void initState() {
    super.initState();

    final params = ConsentRequestParameters();
    ConsentInformation.instance.requestConsentInfoUpdate(
      params,
      () async {
        debugPrint('AAT request');
        // The consent information state was updated.
        // You are now ready to check if a form is available.
        if (await ConsentInformation.instance.isConsentFormAvailable()) {
          loadForm();
        } else{
          debugPrint('AAT Consent Form unavailable');
        }
      },
      (FormError error) {
        debugPrint('AAT error: $error');
        // Handle the error
      },
    );

    _createInterstitialAd();
    _createRewardedAd();
    _createRewardedInterstitialAd();
  }

void loadForm() {
    ConsentForm.loadConsentForm(
      (ConsentForm consentForm) async {
        var status = await ConsentInformation.instance.getConsentStatus();
        if (status == ConsentStatus.required) {
          consentForm.show(
            (FormError? formError) {
              // Handle dismissal by reloading form
              loadForm();
            },
          );
        }
      },
      (FormError formError) {
        // Handle the error
      },
    );
  }
  1. Run the app

Expected results:

ATT dialog should appear

Actual results:

No ATT dialog displayed. Logs indicate that there's no consent form available

Logs
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.6 21G115 darwin-x64, locale en-PH)
    • Flutter version 3.3.2 on channel stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (3 weeks ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F100
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • 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.12+0-b1504.28-7817840)

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

[✓] Connected device (3 available)
    • iPhone 13 Pro (mobile) • B262ADE9-F80C-4797-AA2D-E32F3E1065B2 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-x64     • macOS 12.6 21G115 darwin-x64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@huycozy huycozy added the in triage Issue currently being evaluated label Oct 6, 2022
@huycozy
Copy link
Collaborator

huycozy commented Oct 6, 2022

Hi @omatt, Could you provide a completed and minimal reproducible code sample so that we may verify this? In this case, it contains setup in iOS project, so it will be better if you can push the sample code into a GitHub repository and make it public.
Thank you!

@huycozy huycozy added the feedback required Further information is requested label Oct 6, 2022
@omatt
Copy link
Author

omatt commented Oct 6, 2022

You can use the sample provided in google_mobile_ads. Add the code snippet I've provided in the sample's main.dart and update the Info.plist in the iOS build.

@github-actions github-actions bot removed the feedback required Further information is requested label Oct 6, 2022
@huycozy
Copy link
Collaborator

huycozy commented Oct 6, 2022

@omatt You can try adding testIdentifiers in ConsentDebugSettings to ConsentRequestParameters. You can get TEST-DEVICE-HASHED-ID from the console log.
For more information: https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/eu-consent#testing

Sample code - only modified initState()
void initState() {
    super.initState();

    ConsentDebugSettings debugSettings = ConsentDebugSettings(
        debugGeography: DebugGeography.debugGeographyEea,
        testIdentifiers: ['TEST-DEVICE-HASHED-ID']);

    final params = ConsentRequestParameters(consentDebugSettings: debugSettings);
    ConsentInformation.instance.requestConsentInfoUpdate(
      params,
          () async {
        debugPrint('AAT request');
        // The consent information state was updated.
        // You are now ready to check if a form is available.
        if (await ConsentInformation.instance.isConsentFormAvailable()) {
          loadForm();
        } else{
          debugPrint('AAT Consent Form unavailable');
        }
      },
          (FormError error) {
        debugPrint('AAT error: $error');
        // Handle the error
      },
    );

    _createInterstitialAd();
    _createRewardedAd();
    _createRewardedInterstitialAd();
  }
Demo

@huycozy huycozy added the feedback required Further information is requested label Oct 6, 2022
@omatt
Copy link
Author

omatt commented Oct 7, 2022

Thanks @huycozy, passing a ConsentDebugSettings in ConsentRequestParameters() does show a Consent dialog, but this seems to be different from the App Tracking Transparency dialog that's mentioned in the documentation. Am I missing something?

I'm also expecting the app to appear under Tracking Settings which can be found in Settings > Privacy > Tracking

@github-actions github-actions bot removed the feedback required Further information is requested label Oct 7, 2022
@huycozy
Copy link
Collaborator

huycozy commented Oct 10, 2022

@omatt I'm not sure if the dialog will change in production or different geography, can you try using another DebugGeography value to see if it achieves the expected behavior?

/cc @jjliu15 for thoughts.

@c0ffeec0der
Copy link

c0ffeec0der commented Oct 25, 2022

With:

  1. Admob account approved
  2. App status in review
  3. GDPR message created

In android development, following this example would result method isConsentFormAvailable() return false

Thus output 'AAT Consent Form unavailable', no dialog box appear

I/Ads     ( 6995): This request is sent from a test device.
I/flutter ( 6995): AAT request
I/flutter ( 6995): AAT Consent Form unavailable

Is there different behavior for Android and Ios platform for method isConsentFormAvailable()? I see from example above in Ios, the dialog box appear, but not in android.

Question: Is this a legitimate bug in the SDK?

Thank you

@huycozy
Copy link
Collaborator

huycozy commented Oct 26, 2022

Hi @c0ffeec0der
Did you add your test identifier ID into testIdentifiers? You can find it from the console log.

@c0ffeec0der
Copy link

Hi @huycozy

Sorry I haven't add it..

Just now I added and it's still not working. The response from admob is

D/UserMessagingPlatform( 5919): Stored info not exists: IDFA_freqCapNumViews D/UserMessagingPlatform( 5919): Stored info not exists: IABTCF_TCString D/UserMessagingPlatform( 5919): Stored info not exists: IABTCF_AddtlConsent W/UserMessagingPlatform( 5919): Invalid response from server.

Kindly advise, Thank you

@huycozy
Copy link
Collaborator

huycozy commented Oct 27, 2022

@c0ffeec0der Please check this SO answer and please provide a completed and minimal reproducible code sample so that we may verify this. Thanks!

@c0ffeec0der
Copy link

Hi @huycozy

The only difference with SO is 'tagForUnderAgeOfConsent: false' ; it's still not working..

I have created a repository with the code sample as requested

Kindly advise, Many Thanks

@huycozy
Copy link
Collaborator

huycozy commented Oct 27, 2022

@c0ffeec0der Yes, I also can reproduce this issue on Android whilst it works fine on iOS. I will reopen #678 due to this issue reporting for iOS. Thanks!

@github-actions
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback required Further information is requested in triage Issue currently being evaluated
Projects
None yet
Development

No branches or pull requests

3 participants