blaugold / user_messaging_platform

A flutter plugin which provides a Dart API for the User Messaging Platform (UMP) SDK, which is the Consent Management Platform (CMP) SDK provided as part of Google's Funding Choices.
https://pub.dev/packages/user_messaging_platform
MIT License
9 stars 5 forks source link

FormException(message: No available form can be built., code: FormErrorCode.invalidOperation) #18

Closed samatzp closed 2 years ago

samatzp commented 2 years ago

Hi! Thanks for package!

I have with problem showing consent form

consentStatus = ConsentStatus.notRequired formStatus = FormStatus.unavailable

Error: FormException(message: No available form can be built., code: FormErrorCode.invalidOperation)

blaugold commented 2 years ago

Hm, I don't think you can show a form when consent is not required.

But for testing and debugging, you can use ConsentDebugSettings:

await UserMessagingPlatform.instance.requestConsentInfoUpdate(
   ConsentRequestParameters(
       debugSettings : ConsentDebugSettings(
         geography: DebugGeography.EEA,
      ),
   ),
);

Also, see the docs for ConsentDebugSettings.testDeviceIds.

samatzp commented 2 years ago

I tried without and with VPN

Below is the code that I am using:

try {
  var info = await UserMessagingPlatform.instance
      .requestConsentInfoUpdate(ConsentRequestParameters(
      debugSettings: ConsentDebugSettings(
geography: DebugGeography.EEA,
          testDeviceIds: ['MyDeviceId']
      )));
  print(info.consentStatus);
  print(info.formStatus);

  //error
  var test = await UserMessagingPlatform.instance.showConsentForm();

  print(test.consentStatus);
  print(test.formStatus);
}catch (err){
  print('Error tt');
  print(err);
}
blaugold commented 2 years ago

In that case, I'm not sure what's the problem. Just to make sure, did you configure messages in AdMob under Privacy & messaging?

samatzp commented 2 years ago

Yes

But Approval status is --> Getting ready Could this affect?

google_admob_2022-03-11_19-49-45

2022-03-11_21-54-42

samatzp commented 2 years ago

Work after --> Approval status = Ready Thanks!

blaugold commented 2 years ago

Thanks for the update! Glad it worked itself out.

Quietly-20201113 commented 2 months ago
D/HwDragEnhancementImpl(21763): Start long press for hw drag enhancement.
D/WebViewDragEnhancement(21763): dragReset.
D/WebViewDragEnhancement(21763): dragReset cacheSize = 0
V/AudioManager(21763): querySoundEffectsEnabled...
I/AudioManager(21763): querySoundEffectsEnabled fail id: 0
W/UserMessagingPlatform(21763): No available form can be built.
E/flutter (21763): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FormException(message: No available form can be built., code: FormErrorCode.invalidOperation)
E/flutter (21763): #0      UserMessagingPlatform.showConsentForm (package:user_messaging_platform/user_messaging_platform.dart:375:7)
E/flutter (21763): <asynchronous suspension>
E/flutter (21763): 

When I get an error using the official demo, how do I solve it?