Request consent for iOS in Flutter

539 views Asked by At

I want to request consent using UMP SDK in iOS app. I followed this article. In short, I did following.

main.dart:

void main() {
  requestConsent();
  MobileAds.instance.initialize();
  runApp(const MyApp());
  ...
}

void requestConsent() {
  final params = ConsentRequestParameters();
  ConsentInformation.instance.requestConsentInfoUpdate(
    params,
    () async {
      if (await ConsentInformation.instance.isConsentFormAvailable()) {
        loadForm();
      }
    },
    (error) {});
}

void loadForm() {
   ConsentForm.loadConsentForm((consentForm) async {
     var status = await ConsentInformation.instance.getConsentStatus();
     if (status == ConsentStatus.required) {
       consentForm.show((formError) {
         loadForm();
       });
     }
  },
  (formError) {});
}

The consent is working as expected. The dialog window is displayed (in fact, two dialog windows in iOS - consent and app tracking). My question is, how to set non-personalized ads in case consent is not given? The documentation is really brief in this topic:

final AdRequest = AdRequest(nonPersonalizedAds: true);

Where to find the information, whether the user gave consent to display PA/NPA? In loadConsentForm(), there is ConsentStatus.obtained only, but this only tells me that user submitted the consent form, not the result. Thank you for any help or guidance.

0

There are 0 answers