Skip to content
A simple Android library to show Privacy Policy, Terms of Service and General Data Protection Regulation (GDPR)
Branch: master
Clone or download
Latest commit 80ab994 Sep 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Added Europe only Sep 8, 2018
art Init Apr 27, 2018
build/kotlin-build Added Europe only Sep 8, 2018
gradle/wrapper Init Apr 27, 2018
library Added Europe only Sep 8, 2018
Android-Privacy-Policy.iml Added Europe only Sep 8, 2018
README.md Update README.md Sep 8, 2018
build.gradle Init Apr 27, 2018
gradle.properties Init Apr 27, 2018
gradlew Init Apr 27, 2018
gradlew.bat Init Apr 27, 2018
local.properties Added Europe only Sep 8, 2018
settings.gradle Init Apr 27, 2018

README.md

Android-Privacy-Policy

A simple Android library to show Privacy Policy, Terms of Service and General Data Protection Regulation (GDPR).

Api-level 16+

Preview:

Usage:

Add the repository to your gradle app

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    implementation 'com.github.khirr:Android-Privacy-Policy:1.0.1'
}

Add this view to your code

// Initialice your dialog, first param is your terms of service url, and second param is your privacy policy url

PrivacyPolicyDialog dialog = new PrivacyPolicyDialog(this,
                "https://localhost/terms",
                "https://localhost/privacy");

Add your policy lines, the most import for users, your full policy and terms of service are on your urls.

dialog.addPoliceLine("This application uses a unique user identifier for advertising purposes, it is shared with third-party companies.");
dialog.addPoliceLine("This application sends error reports, installation and send it to a server of the Fabric.io company to analyze and process it.");
dialog.addPoliceLine("This application requires internet access and must collect the following information: Installed applications and history of installed applications, ip address, unique installation id, token to send notifications, version of the application, time zone and information about the language of the device.");
dialog.addPoliceLine("All details about the use of data are available in our Privacy Policies, as well as all Terms of Service links below.");

Add your listener

final Intent intent = new Intent(this, SecondActivity.class);

dialog.setOnClickListener(new PrivacyPolicyDialog.OnClickListener() {
    @Override
    public void onAccept(boolean isFirstTime) {
        Log.e("MainActivity", "Policies accepted");
        startActivity(intent);
        finish();
    }

    @Override
    public void onCancel() {
        Log.e("MainActivity", "Policies not accepted");
        finish();
    }
});

Enable for Europe only

dialog.setEuropeOnly(true);

Full dialog customizing

//  Example
dialog.setTitleTextColor(Color.parseColor("#222222"));
dialog.setAcceptButtonColor(ContextCompat.getColor(this, R.color.colorAccent));

License

MIT

You can’t perform that action at this time.