I get errors when I'm trying to add the gdpr code

115 views Asked by At

t

i get this errors guys when i'm trying to add the gdpr code i tried some methods but i'm stil having the same issue i hope guys if someone can help i'd appreciate it thank you.

// TODO: Replace with your app's privacy policy URL.
        privacyUrl = new URL("https://www.your.com/privacyurl");
    } catch (MalformedURLException e) {
        e.printStackTrace();
        // Handle error.
    }
    ConsentForm form = new ConsentForm.Builder(context, privacyUrl)
            .withListener(new ConsentFormListener() {
                @Override
                public void onConsentFormLoaded() {
                    // Consent form loaded successfully.
                }

                @Override
                public void onConsentFormOpened() {
                    // Consent form was displayed.
                }
1

There are 1 answers

2
Martin Zeitler On

Add the dependency into the module's build.gradle:

// Google AdMob, EU Cookie Consent
implementation ("com.google.android.ads.consent:consent-library:1.0.7") {
    // exclude group: "com.google.code.gson"
}

The imports are:

import com.google.ads.consent.AdProvider;
import com.google.ads.consent.ConsentForm;
import com.google.ads.consent.ConsentFormListener;
import com.google.ads.consent.ConsentInfoUpdateListener;
import com.google.ads.consent.ConsentInformation;
import com.google.ads.consent.ConsentStatus;
import com.google.ads.consent.DebugGeography;