AppConsent Unity
 
Loading...
Searching...
No Matches
SFBX.AppConsent.ACNotice Class Reference

Public Member Functions

 ACNotice (string appKey, bool forceApplyGDPR=false, bool forceATT=false, bool fullscreen=false, string dedicatedEndpointURL="", string dedicatedAssetsURL="")
 Create an instance of ACNotice to be able to use AppConsent CMP later on.
 
void InitACNotice ()
 Setup the AppConsent CMP on ANDROID.
 
void SetPresentNoticeListener (ISDKPresentNoticeListener sDKPresentNoticeListener)
 ANDROID ONLY !
 
void RemovePresentNoticeListener ()
 ANDROID ONLY !
 
bool ShowNotice ()
 Displays the CMP Notice if needed.
 
bool ShowSettings ()
 Displays the Privacy Settings.
 
void ClearConsents ()
 Clears user consents preferences.
 
bool ConsentGiven ()
 Get a boolean to know if the consent is already given.
 
bool IsSubjectToGDPR ()
 Get a boolean to know if device is running in a GDPR Countries.
 
bool UserAcceptAll ()
 Get a boolean to know if current user accept all consentables, stacks and vendors or not.
 
bool AllConsentablesAllowed ()
 Get a boolean to know if all consentables are allowed or not.
 
bool ExtraVendorAllowed (string extraVendorId)
 Get a boolean to know if an extra vendor is allowed or not.
 
bool ConsentableAllowed (int iabId, int consentableType)
 Get a boolean to know if a consentable is allowed or not.
 

Static Public Member Functions

static void SetNoticeCallback (ISDKCallbackListener sdkCallback)
 ANDROID ONLY !
 

Static Public Attributes

const string PACKAGE_UNITY_PLAYER = "com.unity3d.player.UnityPlayer"
 

Constructor & Destructor Documentation

◆ ACNotice()

SFBX.AppConsent.ACNotice.ACNotice ( string appKey,
bool forceApplyGDPR = false,
bool forceATT = false,
bool fullscreen = false,
string dedicatedEndpointURL = "",
string dedicatedAssetsURL = "" )
inline

Create an instance of ACNotice to be able to use AppConsent CMP later on.

Setup the CMP by calling this function, passing it your appKey. The CMP detects if the app is running on a device that is inside a GDPR country, with forceApplyGDPR you can choose to bypass the check, and let the CMP always behave according to GDPR. The ATT checks can be enforced with forceATT, this defaults to false.

On Android ONLY, you need to call the ACNotice::InitACNotice method, which initializes the CMP after creating the instance and passing it all the configuration parameters (appKey & forceApplyGDPR). On iOS, after creating this instance of ACNotice, you can start using it (ACNotice::showNotice, ACNotice::showSettings, ACNotice::consentGiven, ...).

Parameters
appKeyThe AppKey String from Back Office.
forceApplyGDPRBoolean to indicate if you want to force GDPR, if false AppConsent will check country to determine GDPR application, if true AppConsent will always behave as in a GDPR country. Defaults to false.
forceATTBoolean to indicate if you want to force App Tracking Transparency. Defaults to false.

Member Function Documentation

◆ AllConsentablesAllowed()

bool SFBX.AppConsent.ACNotice.AllConsentablesAllowed ( )
inline

Get a boolean to know if all consentables are allowed or not.

Returns

◆ ClearConsents()

void SFBX.AppConsent.ACNotice.ClearConsents ( )
inline

Clears user consents preferences.

This only clears local consent in UserDefaults, all of the IABTCF UserDefaults are erased.

◆ ConsentableAllowed()

bool SFBX.AppConsent.ACNotice.ConsentableAllowed ( int iabId,
int consentableType )
inline

Get a boolean to know if a consentable is allowed or not.

Parameters
iabIdIs an iabId
consentableTypeis an NSInteger (0: purpose ,1: feature , 2: specialFeature ,3: specialPurpose)
Returns
true if consentable is allowed

◆ ConsentGiven()

bool SFBX.AppConsent.ACNotice.ConsentGiven ( )
inline

Get a boolean to know if the consent is already given.

Returns
true if consent preferences where saved

◆ ExtraVendorAllowed()

bool SFBX.AppConsent.ACNotice.ExtraVendorAllowed ( string extraVendorId)
inline

Get a boolean to know if an extra vendor is allowed or not.

Parameters
extraVendorIdIs an extraId String
Returns

◆ InitACNotice()

void SFBX.AppConsent.ACNotice.InitACNotice ( )
inline

Setup the AppConsent CMP on ANDROID.

For easier integration, this method can be used on both iOS and Android without making any distinction (it only works on ANDROID thanks to the constant UNITY_ANDROID Platform Dependent Compilation).

This method is MANDATORY on Android to initialize the CMP! Don't forget to define the initialization callback ACNotice::SetNoticeCallback to receive the callback indicating that the CMP is ready for use

◆ IsSubjectToGDPR()

bool SFBX.AppConsent.ACNotice.IsSubjectToGDPR ( )
inline

Get a boolean to know if device is running in a GDPR Countries.

Returns
true if current device is located in a country subject to GDPR

◆ RemovePresentNoticeListener()

void SFBX.AppConsent.ACNotice.RemovePresentNoticeListener ( )
inline

ANDROID ONLY !

For easier integration, this method can be used on both iOS and Android without making any distinction (it only works on ANDROID thanks to the constant UNITY_ANDROID Platform Dependent Compilation).

Remove the presentNotice callback (ISDKPresentNoticeListener)

◆ SetNoticeCallback()

static void SFBX.AppConsent.ACNotice.SetNoticeCallback ( ISDKCallbackListener sdkCallback)
inlinestatic

ANDROID ONLY !

Defines the callback that lets you know when the SDK has finished initializing and is ready for use on ANDROID. You must call this method before calling ACNotice::InitACNotice if you want receive a callback.

Parameters
sdkCallbackYour callback

◆ SetPresentNoticeListener()

void SFBX.AppConsent.ACNotice.SetPresentNoticeListener ( ISDKPresentNoticeListener sDKPresentNoticeListener)
inline

ANDROID ONLY !

For easier integration, this method can be used on both iOS and Android without making any distinction (it only works on ANDROID thanks to the constant UNITY_ANDROID Platform Dependent Compilation).

Defines the callback that lets you know when the user has completed the consent process. Once the callback has been called (ISDKPresentNoticeListener::onConsentGiven), you can start initializing your Advertising SDK.

Parameters
sdkCallbackYour callback

◆ ShowNotice()

bool SFBX.AppConsent.ACNotice.ShowNotice ( )
inline

Displays the CMP Notice if needed.

Once the CMP has been initialized, call this to display the Notice UI. Internally, this function checks if a user has already saved their preferences:

  • if yes, then the CMP Notice is not displayed.
  • if not, the CMP Notice is displayed, so the user can save their preferences.

This function returns as soon as the CMP Notice has been displayed, so when it returns, the user may not have saved their preferences yet.

Returns
true if consent preferences where displayed, false otherwise (CMP UI not displayed)

◆ ShowSettings()

bool SFBX.AppConsent.ACNotice.ShowSettings ( )
inline

Displays the Privacy Settings.

Once the CMP has been initialized, call this to display the Privacy Settings UI. Internally, this function checks if a user has already saved their preferences:

  • if yes, the introduction and global choices screen is not shown, and the CMP Notice displays the detailed preferences page. This is used to allow the user to change their preferences.
  • if not, the CMP Notice is displayed as usual.

This function returns as soon as the CMP Notice has been displayed, so when it returns, the user may not have saved their preferences yet.

Returns
true if consent preferences where displayed, false otherwise (CMP UI not displayed)

◆ UserAcceptAll()

bool SFBX.AppConsent.ACNotice.UserAcceptAll ( )
inline

Get a boolean to know if current user accept all consentables, stacks and vendors or not.

Returns
true if user accepted all consentables, stacks and vendors