Android
Get AppConsent SDKβ
To add the AppConsent SDK to your Android project, follow the steps below :
Declaration of the repositoryβ
Gradle <6.8β
In the build.gradle
file at the root of your project, add the following:
repositories {
...
maven {
url "https://artifactory.datalf.chat/artifactory/app-consent-v2-release"
}
}
Gradle >=6.8β
In your settings.gradle
file, at the root of your project, add the following :
dependencyResolutionManagement {
...
repositories {
...
maven {
url "https://artifactory.datalf.chat/artifactory/app-consent-v2-release"
}
}
}
Library integrationβ
In your application build.gradle
add the following:
- Clear template development kit (SDK)
- Classic template development kit (SDK)
dependencies {
implementation 'com.sfbx.appconsent:appconsent-ui-v3:${currentUIV3Version}'
}
Where currentUIV3Version = 2.0.14
dependencies {
implementation 'com.sfbx.appconsent:appconsent-ui:${currentUIVersion}'
}
Where currentUIVersion = 1.1.26
How to use AppConsentβ
1. Get your AppKey from AppConsent : https://app.appconsent.ioβ
2. Create AppConsent Instanceβ
- Clear template development kit (SDK)
- Classic template development kit (SDK)
import com.sfbx.appconsentv3.ui.AppConsentUIV3
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val appConsent = AppConsentUIV3(
context = this,
appKey = "YOUR_APP_KEY"
) {
it.presentNotice(false)
}
}
}
import com.sfbx.appconsent.ui.AppConsentUI
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val appConsent = AppConsentUI(
context = this,
appKey = "YOUR_APP_KEY"
) {
it.presentNotice(false)
}
}
}
info
Function onReady()
is called when AppConsent finished initializing. It can avoid bugs when you want to present notice just after creating AppConsent object.
3. Then use appConsent objectβ
For more information please refer to our technical documentation
4. Retrieve your consentsβ
Your consents are saved in SharedPreferences
of your application. To know more about keys used to save your consents, please refer to the IAB documentation.
We also provide an additional key for Google Additionnal Consent IABTCF_AddtlConsent
returning a String.
5. Xchangeβ
In your application build.gradle
add the following
- Clear template development kit (SDK)
- Classic template development kit (SDK)
dependencies {
implementation 'com.sfbx.appconsent:appconsent-ui-v3-xchange:${currentUIV3Version}'
}
Where currentUIV3Version = 2.0.14
dependencies {
implementation 'com.sfbx.appconsent:appconsent-ui-xchange:${currentUIVersion}'
}
Where currentUIVersion = 1.1.26
- Set xchange user data
appConsent.setXchangeUserData(
XChangeUserData.Builder()
.email("test@sfbx.io")
.build()
)
Save user data in cache, and when user give his consent, data are sent to server.
API referenceβ
The API reference is here.