AATKit Android Integration
Release Notes
  • Start
    • Setup
      • Maven
      • Prerequisites
      • Google Family Safe Apps
    • Initialization
    • Consent
      • General Handling
      • Managed Consent
        • Google CMP
        • Sourcepoint CMP
        • SFBX (AppConsent) CMP
      • Vendor Consent
      • Simple Consent
    • Plugins documentation
    • Additional Information
  • Formats
    • Introduction
    • Banner
      • Auto Load Banner
      • Multi-Size Auto Load Banner
      • Banner Cache
      • Infeed Banner
      • Sticky Banner
      • Multi-Size Banner
    • Fullscreen (Interstitial)
    • AppOpen (Google)
    • Rewarded Video
      • Server-Side Verification (SSV)
    • Native Ad
      • Basic Integration
      • Network Specifics
        • Native Ads: Google
        • Native Ads: ApplovinMax
        • Native Ads: Bluestack
        • Native Ads: FacebookAudienceNetwork
        • Native Ads: Huawei
  • Ad Networks
    • Customize Ad Networks
    • Google Mobile Ads SDK
    • AppLovinMax Ad Review
    • AppNexus special settings
    • FeedAd Shutter Colour and Disabling Spinner
    • Kidoz
  • Advanced
    • Targeting
      • Key-Value Targeting
      • User Targeting
      • Content Targeting URL
    • Frequency Capping
    • Advanced Listeners
      • Reports Delegate
      • Impression Listener (ILRD)
      • Statistics Listener
    • AATKit's Size
    • Ad Space and Fill Rate
    • Shake Debug
    • Child-directed Support
    • Geo Tracking
    • Disabling Ad Networks
    • Huawei Support
    • Creatives History
  • Other
    • AdMob Custom Events
    • Reference
      • Classes
        • AATKit
        • AATKitUserTargeting
        • CollapsibleBannerOptions
        • AATKitDebugScreenConfiguration
        • PlacementDebugInfo
        • AATKitDebugInfo
        • AATKitConfiguration
        • AATKitRuntimeConfiguration
        • ManagedConsent
        • VendorConsent
        • SimpleConsent
        • BannerConfiguration
        • BannerRequest
        • BannerCacheConfiguration
        • AATKitReward
        • NativeAdRating
        • AATKitImpression
        • PriceInfo
        • AdInfo
        • RewardedAdSSVInfo
        • PlacementHistoryInfo
        • AATKitAdNetworkOptions
          • SuperAwesomeOptions
          • FeedAdOptions
          • AppNexusOptions
          • AdMobOptions
          • DFPOptions
      • Interfaces
        • CacheStatusDelegate
        • AATKit.Delegate
        • BannerCache
        • BannerRequestCompletionListener
        • ManagedConsentDelegate
        • VendorConsentDelegate
        • Placement
        • StickyBannerPlacement
        • StickyBannerPlacementListener
        • MultiSizeBannerPlacement
        • MultiSizeBannerPlacementListener
        • InfeedBannerPlacement
        • InfeedBannerPlacementListener
        • BannerRequestDelegate
        • CacheDelegate
        • FullscreenPlacement
        • FullscreenPlacementListener
        • AppOpenAdPlacement
        • AppOpenPlacementListener
        • RewardedVideoPlacement
        • RewardedVideoPlacementListener
        • NativeAdPlacement
        • NativePlacementListener
        • NativeAdData
        • AutoLoadBannerPlacement
        • AutoLoadBannerPlacementListener
        • AutoLoadMultiSizeBannerPlacement
        • AutoLoadMultiSizeBannerPlacementListener
        • ReportsDelegate
        • ImpressionListener
        • StatisticsListener
      • Enumerations
        • AATKitGender
        • AdNetwork
        • ManagedConsentState
        • NonIABConsent
        • BannerPlacementSize
        • BannerSize
        • MediationType
        • ImpressionPricePrecisionType
  • Samples
Powered by GitBook
On this page
  • Requirements
  • Usage
  1. Start
  2. Consent
  3. Managed Consent

SFBX (AppConsent) CMP

Last updated 6 months ago

Requirements

  • Add the needed maven repository to your list:

    maven { // SFBX CMP
            url "https://artifactory.datalf.chat/artifactory/app-consent-v2-release"
    }
  • Add the SFBX CMP dependency to your build.gradle:

implementation 'com.sfbx.appconsent:appconsent-ui-v3:5.3.0'

Make sure, your SFBX CMP has been set up at its backend dashboard. Our support recommends certain vendors to be included in your server-side setup in order to yield optimal revenues.

Usage

Follow the instructions in the Managed Consent .

SFBX CMP needs an Activity instance when being created.

  • Create an instance of CMPAppConsent (CMPAppConsent implements CMPinterface).

  • Pass the created CMPAppConsent instance while creating the ManagedConsent using the public constructor ManagedConsent(cmp: CMP, context: Context, delegate: ManagedConsent.ManagedConsentDelegate).

private ManagedConsent managedConsent;

public void onActivityReady(Activity activity) {
    if (managedConsent == null) { //we want to do it only once
        CMP cmp = new CMPAppConsent(activity, "<APP_KEY>");
        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
}
private var managedConsent: ManagedConsent? = null

fun onActivityReady(activity: Activity) {
    if (managedConsent == null) { //we want to do it only once
        val cmp: CMP = CMPAppConsent(activity, "<APP_KEY>")
        managedConsent = ManagedConsent(cmp, this, this)
        val newConf = AATKitRuntimeConfiguration()
        newConf.consent = managedConsent
        AATKit.reconfigure(newConf)
        managedConsent?.showIfNeeded(activity)
        OR
        managedConsent?.showIfNeededOrRejected(10, activity)
    }
}

// ManagedConsentDelegate implementation
fun managedConsentNeedsUserInterface(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>)
}

fun managedConsentCMPFinished(state: ManagedConsentState) {
    // The user finished his action with CMP with the state as the user chosen state
}

fun managedConsentCMPFailedToLoad(managedConsent: ManagedConsent, error: String?) {
    // 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
}

fun managedConsentCMPFailedToShow(managedConsent: ManagedConsent, error: String?) {
    // CMP failed to show with the error message
}
introduction section