PubConsent
Consent sharing with WebView
3min
this guide explains how to use the consent sharing functionality through the apis provided in the android and ios sdks the implementation allows synchronization of consent data between your application and a webview via a javascript script the apis described below are available starting from version v3 x x of the android and ios sdks android in the android sdk, consent can be managed using the `cmp` object and the `onconsentready` method once the consent api is ready, a `consentapiinterface` is provided, which can be used to obtain the necessary javascript to pass as a parameter to the webview's `evaluatejavascript` below is an example cmpinstance onconsentready { consentapiinterface > webview\ evaluatejavascript(consentapiinterface getjavascriptforwebview()) { s > } }kot ios in the ios sdk, consent is managed through pubconsentcmp shared once the consent api is ready, a consentapiinterface is provided, which can be used to obtain the necessary javascript to pass as a parameter to the webview's evaluatejavascript pubconsentcmp shared onconsentready { consentapiinterface in webview\ evaluatejavascript(consentapiinterface getjavascriptforwebview()) { (result, error) in } } the cmp still display since delays might occur, you can prevent the cmp from appearing in your webview by adding the following query string to the url ?pubconsent waitforexternalconsent=1 this will block the cmp from appearing in the webview instead, the cmp in the webview will wait for the consent to be shared using the apis described above