Sourcepoint CMP
Requirements
implementation 'com.sourcepoint.cmplibrary:cmplibrary:<version>'Usage
private ManagedConsent managedConsent;
public void onActivityReady(Activity activity) {
if (managedConsent == null) { //we want to do it only once
CMP cmp = new CMPSourcePoint(activity, <accountId>, <propertyId>, <propertyName>, <pmId>);
managedConsent = new ManagedConsent(cmp, this, this);
AATKitRuntimeConfiguration newConf = new AATKitRuntimeConfiguration();
newConf.setConsent(managedConsent);
AATKit.reconfigure(newConf);
managedConsent.showIfNeeded(activity);
OR
managedConsent.showIfNeededOrRejected(10, activity);
}
}
// ManagedConsentDelegate implementation
@Override
public void managedConsentNeedsUserInterface(@NonNull ManagedConsent managedConsent) {
// CMP is loaded and ready to be shown
// Show the CMP using active Activity
managedConsent.showIfNeeded(<ACTIVITY_INSTANCE>);
OR
managedConsent.showIfNeededOrRejected(10, <ACTIVITY_INSTANCE>);
}
@Override
public void managedConsentCMPFinished(@NonNull ManagedConsent.ManagedConsentState state) {
// The user finished his action with CMP with the state as the user chosen state
}
@Override
public void managedConsentCMPFailedToLoad(@NonNull ManagedConsent managedConsent, String error) {
// CMP failed to load with the error message.
// Consider reloading the CMP using the active Activity:
// managedConsent.reload(<ACTIVITY_INSTANCE>);
// if you know that the user is in GDPR region
}
@Override
public void managedConsentCMPFailedToShow(@NonNull ManagedConsent managedConsent, String error) {
// CMP failed to show with the error message
}Last updated