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
consentStatus always has the value 0 (Unknown) #631
Comments
This is a well known bug, the plugin "as is" doesn't work 100% flawless. See my workaround; You can get rid of the "on exit kill this app" plugin (mentioned in this thread) by setting another boolean check before really showing the form; (raw code, not the code from the plugin) |
to get the consent.ConsentStatus you must always first execute consent.requestInfoUpdate() This is well explained in the official Admob documentation, but not explained in this plugin. But regardless, your app should always execute consent.requestInfoUpdate() to start with, then the consentstatus will be updated, then you can show the form if status states 'required' |
Thank you very much! That is the solution. I changed the order of the sentences in the code and now it works perfectly. This is how it looks like:
@ratson It must be changed in the plugin documentation. |
@sergip76 I tried it, but it's not working, i got no response from ' const consentStatus = await consent.getConsentStatus();' please can you explain more about how to integrate it I may have missed something. |
I simply added this code just before displaying the advertisement. You have to keep in mind that it must be inside an asynchronous function. For example:
And to show it:
IMPORTANT: Remember to add your custom message for the specific application in your Admob account. |
Plugin version:
admob-plus-cordova 2.0.0-alpha.13
cordova-plugin-consent 3.0.0-alpha.4
When starting the application for the first time consentStatus always has the value 0 (Unknown). Therefore the form is not displayed.
If I force to show the form using this code:
the form is displayed. I do not respond and I close the app. The next times the application is opened consentStatus is already set to 1 (Required).
It seems that the form must be displayed at least once for the consentStatus to have a correct value and not be 0.
The behavior is the same for both Android and iOS.
The text was updated successfully, but these errors were encountered: