Need help with GDPRDialog?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

199 Stars 51 Forks Apache License 2.0 275 Commits 3 Opened issues


GDPR fragment dialog implementation

Services available


Need anything else?

Contributors list

GDPRDialog Release Localisation

Simple reusable


GDPR Demo1 GDPR Demo2

What it offers

This library offers following:

  • supports
  • supports multiple services, already defined ones are AdMob and Firebase
  • supports intermediator services as well, also supports to load your ad providers from AdMob
  • supports custom service definitions
  • is set up via a setup class that allows you to select which possibilities you give the user - any combination of personalised ads, non personalised ads and paid version, depending on what you want. Examples:
    • allow personalised ads or paid version only
    • allow personalised ads, non personalised ads or paid or free version
    • combine whatever you want here...
  • optionally enable location checks (supports google's check from the SDK via the internet,
    ) and also allows to define to use fallback methods, by providing your own list of checks sorted by their priority
  • optionally adds a
    for age confirmation
  • uses soft opt in by default if you offer e.g. a personalised ads vs non personalised ads version
  • it closes the app if the user did not give any consent (i.e if the user clicks the back button in the dialog)
  • it manages the user's selected consent decision and remembers it (including location, date and app version)
  • it automatically reshows the dialog if the user did not give any consent or if the setup defines that the app is not allowed to be used without ads and the user has not accepted ads at all yet

GDPR and law safety

Such dialogs must always be adjusted to the use case in general, although this one should be fine in most cases.

Checkout following to find out more: EU GDPR

Just to make this clear, I'm no lawyer and I can't guarantee that you are save if you use this library.

Gradle (via

  1. add jitpack to your project's
    repositories {
    maven { url "" }
  2. add the compile statement to your module's
    dependencies {
     implementation 'com.github.MFlisar:GDPRDialog:LATEST-VERSION'



  1. Init the singleton in your application
  2. call following in your activities
    GDPRSetup setup = new GDPRSetup(GDPRDefinitions.ADMOB) // add all networks you use to the constructor, signature is `GDPRSetup(GDPRNetwork... adNetworks)`
    // everything is optional, but you should at least provide your policy
    .withCheckRequestLocation(GDPRLocationCheck.DEFAULT) // pass in an array of location check methods, predefined arrays like `DEFAULT` and `DEFAULT_WITH_FALLBACKS` do exists
    .withCheckRequestLocationTimeouts(readTimeout, connectTimeout)
    .withLoadAdMobNetworks(publisherId(s)) // e.g. "pub-0123456789012345"
    .withNoToolbarTheme(noToolbarTheme) // true, if you use a theme without a toolbar, false otherwise
    .withShowPaidOrFreeInfoText(true) // show the info that this app is cheap/free based on the networks or hide it
    .withCustomTexts(customTexts) // provide custom texts (title, top message, main message, question text, age confirmation text) by resource or string
    GDPR.getInstance().checkIfNeedsToBeShown(this /* extends AppCompatActivity & GDPR.IGDPRCallback */, setup);
  3. implement the

    in your activity ```java public class ExampleActivity extends AppCompatActivity implements GDPR.IGDPRCallback { @Override public void onConsentInfoUpdate(GDPRConsentState consentState, boolean isNewState) { // handle consent here


    @Override public void onConsentNeedsToBeRequested() { // we need to get consent, so we show the dialog here GDPR.getInstance().showDialog(this, mSetup); } } ```

  4. Other usages

    // get current consent anywhere in the app after user has given consent
    GDPRConsentState consentState = GDPR.getInstance().getConsentState();
    // get location, time, app version of given consent
    GDPRConsent consent = consentState.getConsent(); // the given constent
    GDPRLocation location = consentState.getLocation(); // where has the given consent been given
    long date = consentState.getDate(); // when has the given consent been given
    int appVersion = consentState.getVersion(); // in which app version has the consent been given
    // check if you can use personal informations or not
    boolean canCollectPersonalInformation = GDPR.getInstance().canCollectPersonalInformation();

Check out the MinimalDemo to get something to start with or check out the DemoActivity with the example setups for a more complex example

Where can I add additional networks?

You can simply do this in the GDPRDefinitions. Of course you can always define new networks in project only as well, but if you think you use a service many others do use as well, fell free to add it to the definitions.


Migrations will be explained in the release notes


  • [ ] Localisation Localisation

At least translations for all official languages within the european union should be added * [ ] Bulgarian * [ ] Croatian * [x] Czech * [ ] Danish * [ ] Dutch * [x] English * [ ] Estonian * [ ] Finnish * [x] French * [x] German * [ ] Greek * [ ] Hungarian * [ ] Irish * [x] Italian * [ ] Latvian * [ ] Lithuanian * [ ] Maltese * [x] Polish * [x] Portuguese * [ ] Romanian * [x] Slovak * [ ] Slovenian * [x] Spanish * [x] Swedish



We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.