CCPA Android SDK to ask for users preferences
Adds a link if the country of the user is unknown or california
if(user clicks links)
if(user from california)
if(okay with data selling)
dismiss()
after link is clicked you can directly jump to second state by setting
<com.anurag.dalia.ccpa.ccpa_sdk.DNSMPI
...
app:dnsmpi_two_states="false"
></com.anurag.dalia.ccpa.ccpa_sdk.DNSMPI>
you can also configure the texts shown in each state with the attributes listed below
add this to your root build.gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
and then add this dependency
dependencies {
...
implementation 'com.github.anuragdalia:ccpa-android-sdk:0.0.8'
}
use this view where ever you wish to show the DNSMPI link (usually on the first screen thats shown to the user)
<com.anurag.dalia.ccpa.ccpa_sdk.DNSMPI
android:layout_width="wrap_content"
android:layout_height="wrap_content" ></com.anurag.dalia.ccpa.ccpa_sdk.DNSMPI>
view configuration attributes and their formats are listed below
if you enable dnsmpi_ask_geo_permission
add this to the activity
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
DNSMPI.onRequestPermissionsResult(requestCode, permissions, grantResults)
}
use only one of these otherwise it will use both the methods and the method that responds last is the decider
dnsmpi_ask_geo_permission and dnsmpi_get_location_internet
At any point to know the preference just call
DNSMPI.canSellData(context) //returns Boolean
//PS ignore the fuck-all readme writing it at 4am and in a hurry :P
//PPS havent even check properly if its working perfectly fine