Programming Tips - Add the Google GDPR consent library to Android Studio project

Date: 2018jun16 OS: Android Language: gradle Q. Add the Google GDPR consent library to Android Studio project A. In project build.gradle
allprojects { repositories { ... google() maven { url "https://maven.google.com" } } }
In module build.gradle
dependencies { ... implementation 'com.google.android.ads.consent:consent-library:1.0.3' }
In your Java code
import com.google.ads.consent.ConsentInformation; ... ConsentInformation consentInformation = ConsentInformation.getInstance(MainActivity.this); if (consentInformation.isRequestLocationInEeaOrUnknown()) { // Europe (probably) } else { // Elsewhere }