-
- All Implemented Interfaces:
public final class Didomi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDidomi.Companion
-
Field Summary
-
Method Summary
Modifier and Type Method Description final EventsRepositorygetEventsRepository()final OrganizationUserRepositorygetOrganizationUserRepository()final UserAgentRepositorygetUserAgentRepository()final ApiEventsRepositorygetApiEventsRepository()final UnitsetApiEventsRepository(@Inject() ApiEventsRepository apiEventsRepository)final ConfigurationRepositorygetConfigurationRepository()final UnitsetConfigurationRepository(@Inject() ConfigurationRepository configurationRepository)final CountryHelpergetCountryHelper()final UnitsetCountryHelper(@Inject() CountryHelper countryHelper)final LanguagesHelpergetLanguagesHelper()final UnitsetLanguagesHelper(@Inject() LanguagesHelper languagesHelper)final BooleanisReady()Is the SDK ready? final BooleanisError()Has an error occurred during SDK initialization. final BooleanisInitialized()Was the SDK initialized? final BooleangetHasAnyStatus()final BooleanisConsentRequired()final BooleanisUserConsentStatusPartial()final BooleanisUserLegitimateInterestStatusPartial()final BooleanisUserStatusPartial()final UserStatusgetUserStatus()final Set<Purpose>getDisabledPurposes()final Set<Purpose>getEnabledPurposes()final Set<Purpose>getRequiredPurposes()final Set<String>getDisabledPurposeIds()final Set<String>getEnabledPurposeIds()final Set<String>getRequiredPurposeIds()final Set<Vendor>getDisabledVendors()final Set<Vendor>getEnabledVendors()final Set<Vendor>getRequiredVendors()final Set<String>getDisabledVendorIds()final Set<String>getEnabledVendorIds()final Set<String>getRequiredVendorIds()final DeviceTypegetDeviceType()final StringgetQueryStringForWebView()final UnitsetLogLevel(Integer minLevel)Set the minimum level of messages to logMessages with a level below minLevelwill not be logged.final Booleanready()Internal use only. final UnitreadyOrThrow()Method used to check if the SDK is ready. final Unitinitialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId, Boolean disableDidomiRemoteConfig, String languageCode, String noticeId)Initialize the Didomi SDK and load its configuration. final Unitinitialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId, Boolean disableDidomiRemoteConfig, String languageCode)Initialize the Didomi SDK and load its configuration. final Unitinitialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId, Boolean disableDidomiRemoteConfig)Initialize the Didomi SDK and load its configuration. final Unitinitialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId)Initialize the Didomi SDK and load its configuration. final Unitinitialize(Application application, DidomiInitializeParameters parameters)Initialize the Didomi SDK and load its configuration. final PurposegetPurpose(String purposeId)Get a purpose from its ID final VendorgetVendor(String vendorId)Get a vendor from its ID final BooleanshouldConsentBeCollected()Check if the consent should be collected depending on if we have any consents or if we have some consents but the number of days before displaying the notice again has not expired yet final BooleangetUserConsentStatusForPurpose(String purposeId)Get the user consent status for a specific purpose final BooleangetUserLegitimateInterestStatusForPurpose(String purposeId)Get the user legitimate interest status for a specific purpose final BooleangetUserConsentStatusForVendor(String vendorId)Get the user consent status for a specific vendor final BooleangetUserLegitimateInterestStatusForVendor(String vendorId)Get the user legitimate interest status for a specific vendor final BooleangetUserStatusForVendor(String vendorId)Get the user consent and legitimate interest status for a specific vendor final BooleangetUserConsentStatusForVendorAndRequiredPurposes(String vendorId)Check if a vendor has consent for all the purposes that it requires final BooleangetUserLegitimateInterestStatusForVendorAndRequiredPurposes(String vendorId)Check if a vendor has consent for all the legitimate interest purposes that it requires final BooleansetUserAgreeToAll()Enable all purposes and vendors for the user. final BooleansetUserDisagreeToAll()Update user status to disagree : disable consent and legitimate interest purposes, disable consent vendors, but still enable legitimate interest vendors. final BooleansetUserConsentStatus(Set<String> enabledPurposeIds, Set<String> disabledPurposeIds, Set<String> enabledLegitimatePurposeIds, Set<String> disabledLegitimatePurposeIds, Set<String> enabledVendorIds, Set<String> disabledVendorIds, Set<String> enabledLegIntVendorIds, Set<String> disabledLegIntVendorIds)final BooleansetUserStatus(Set<String> enabledConsentPurposeIds, Set<String> disabledConsentPurposeIds, Set<String> enabledLIPurposeIds, Set<String> disabledLIPurposeIds, Set<String> enabledConsentVendorIds, Set<String> disabledConsentVendorIds, Set<String> enabledLIVendorIds, Set<String> disabledLIVendorIds, Boolean sendAPIEvent)final BooleansetUserStatus(Set<String> enabledConsentPurposeIds, Set<String> disabledConsentPurposeIds, Set<String> enabledLIPurposeIds, Set<String> disabledLIPurposeIds, Set<String> enabledConsentVendorIds, Set<String> disabledConsentVendorIds, Set<String> enabledLIVendorIds, Set<String> disabledLIVendorIds)Set the user status for each purpose and vendor final BooleansetUserStatus(Boolean purposesConsentStatus, Boolean purposesLIStatus, Boolean vendorsConsentStatus, Boolean vendorsLIStatus)Set the user status globally final BooleansetUserConsentStatusFromObjects(Set<Purpose> enabledPurposes, Set<Purpose> disabledPurposes, Set<Purpose> enabledLegitimatePurposes, Set<Purpose> disabledLegitimatePurposes, Set<Vendor> enabledVendors, Set<Vendor> disabledVendors, Set<Vendor> enabledLegIntVendors, Set<Vendor> disabledLegIntVendors)final BooleansetUserStatusFromObjects(Set<Purpose> enabledConsentPurposes, Set<Purpose> disabledConsentPurposes, Set<Purpose> enabledLIPurposes, Set<Purpose> disabledLIPurposes, Set<Vendor> enabledConsentVendors, Set<Vendor> disabledConsentVendors, Set<Vendor> enabledLIVendors, Set<Vendor> disabledLIVendors, Boolean sendAPIEvent)final BooleansetUserStatusFromObjects(Set<Purpose> enabledConsentPurposes, Set<Purpose> disabledConsentPurposes, Set<Purpose> enabledLIPurposes, Set<Purpose> disabledLIPurposes, Set<Vendor> enabledConsentVendors, Set<Vendor> disabledConsentVendors, Set<Vendor> enabledLIVendors, Set<Vendor> disabledLIVendors)final Unitreset()Remove all consents and user information from the SDK. final UnitonReady(DidomiCallable callback)Provide a function that needs to be called once the SDK is ready Automatically call the function if the SDK is already ready (that's why this is not a standard event) final UnitonError(DidomiCallable callback)Provide a function that needs to be called if the SDK encounters an error during initialization. final UnitaddEventListener(EventListener listener)Add an event listener final UnitaddEventListener(DidomiEventListener listener)Add an event listener final UnitremoveEventListener(DidomiEventListener listener)Remove a previously added event listener final UnitsetupUI(FragmentActivity activity)Show the consent notice if required (ie if consent information is missing)This does not show the consent notice if all consent information is already available as consent was previously collected. final UnitforceShowNotice(FragmentActivity activity)Force show the consent notice without checking if consent is required final UnitshowNotice(FragmentActivity activity)Show the consent notice (if required, not disabled in the config and not already displayed) final UnithideNotice()Hide the notice if it is currently displayed final BooleanisNoticeVisible()Check if the consent notice is currently displayed final UnitshowPreferences(FragmentActivity activity, String view)Method used to show the preferences view, by previously updating the fragment manager property based on an activity. final UnitshowPreferences(FragmentActivity activity)Method used to show the preferences view, by previously updating the fragment manager property based on an activity. final UnithidePreferences()Hide the Preferences dialog final BooleanisPreferencesVisible()Check if the Preferences view is currently displayed final UnitupdateSelectedLanguage(String languageCode)Update the selected language of the Didomi SDK and any property that depends on it. final Map<String, String>getText(String key)Method used to get a dictionary/map for a given key in the form of { en: "Value in English", fr: "Value in French" } from the didomi_config.json file containing translations in different languages. final StringgetTranslatedText(String key)Method used to get a translated string for a given key from the didomi_config.json file based on the currently selected language. final StringgetJavaScriptForWebView(String extra)Get JavaScript to embed into a WebView to pass the consent status from the app to the Didomi Web SDK embedded into the WebViewInject the returned tag into a WebView with evaluateJavaScript.final StringgetJavaScriptForWebView()Get JavaScript to embed into a WebView to pass the consent status from the app to the Didomi Web SDK embedded into the WebViewInject the returned tag into a WebView with evaluateJavaScript.final UnitsetUserAgent(String name, String version)Set custom user agent name and version final UnitsetUser(String organizationUserId, String organizationUserIdAuthAlgorithm, String organizationUserIdAuthSid, String organizationUserIdAuthSalt, String organizationUserIdAuthDigest)Set user information with authentication final UnitsetUser(String organizationUserId, FragmentActivity activity)Set user information final UnitsetUser(String organizationUserId)Set user information final UnitsetUser(UserAuthParams userAuthParams, FragmentActivity activity)Set user information with authentication final UnitsetUser(UserAuthParams userAuthParams)Set user information with authentication final UnitclearUser()Remove organization user information and reset user id final Booleansync(Boolean blocking, FragmentActivity activity)Sync the user information with the remote status final UnitsyncIfRequired(FragmentActivity activity)Refresh the user status from the backend if the SDK is ready final UnitsetLocalProperty(String key, Object value)Internal use only. -
-
Method Detail
-
getEventsRepository
final EventsRepository getEventsRepository()
-
getOrganizationUserRepository
final OrganizationUserRepository getOrganizationUserRepository()
-
getUserAgentRepository
final UserAgentRepository getUserAgentRepository()
-
getApiEventsRepository
final ApiEventsRepository getApiEventsRepository()
-
setApiEventsRepository
final Unit setApiEventsRepository(@Inject() ApiEventsRepository apiEventsRepository)
-
getConfigurationRepository
final ConfigurationRepository getConfigurationRepository()
-
setConfigurationRepository
final Unit setConfigurationRepository(@Inject() ConfigurationRepository configurationRepository)
-
getCountryHelper
final CountryHelper getCountryHelper()
-
setCountryHelper
final Unit setCountryHelper(@Inject() CountryHelper countryHelper)
-
getLanguagesHelper
final LanguagesHelper getLanguagesHelper()
-
setLanguagesHelper
final Unit setLanguagesHelper(@Inject() LanguagesHelper languagesHelper)
-
isInitialized
final Boolean isInitialized()
Was the SDK initialized?
-
getHasAnyStatus
final Boolean getHasAnyStatus()
-
isConsentRequired
final Boolean isConsentRequired()
-
isUserConsentStatusPartial
final Boolean isUserConsentStatusPartial()
-
isUserLegitimateInterestStatusPartial
final Boolean isUserLegitimateInterestStatusPartial()
-
isUserStatusPartial
final Boolean isUserStatusPartial()
-
getUserStatus
final UserStatus getUserStatus()
-
getDisabledPurposes
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getPurposes().getConsent().getDisabled().") final Set<Purpose> getDisabledPurposes()
-
getEnabledPurposes
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getPurposes().getGlobal().getEnabled().") final Set<Purpose> getEnabledPurposes()
-
getRequiredPurposes
final Set<Purpose> getRequiredPurposes()
-
getDisabledPurposeIds
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getPurposes().getConsent().getDisabled().") final Set<String> getDisabledPurposeIds()
-
getEnabledPurposeIds
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getPurposes().getGlobal().getEnabled().") final Set<String> getEnabledPurposeIds()
-
getRequiredPurposeIds
final Set<String> getRequiredPurposeIds()
-
getDisabledVendors
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getDisabled().") final Set<Vendor> getDisabledVendors()
-
getEnabledVendors
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getEnabled().") final Set<Vendor> getEnabledVendors()
-
getRequiredVendors
final Set<Vendor> getRequiredVendors()
-
getDisabledVendorIds
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getDisabled().") final Set<String> getDisabledVendorIds()
-
getEnabledVendorIds
@Deprecated(message = "use {@link #getUserStatus()} instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getEnabled().") final Set<String> getEnabledVendorIds()
-
getRequiredVendorIds
final Set<String> getRequiredVendorIds()
-
getDeviceType
final DeviceType getDeviceType()
-
getQueryStringForWebView
final String getQueryStringForWebView()
-
setLogLevel
final Unit setLogLevel(Integer minLevel)
Set the minimum level of messages to log
Messages with a level below
minLevelwill not be logged. Levels are standard levels fromandroid.util.Log(https://developer.android.com/reference/android/util/Log#constants_1):android.util.Log.VERBOSE (2)
android.util.Log.DEBUG (3)
android.util.Log.INFO (4)
android.util.Log.WARN (5)
android.util.Log.ERROR (6)
We recommend setting
android.util.Log.WARNin production- Parameters:
minLevel- Minimum level of messages to log
-
ready
final Boolean ready()
Internal use only. Method used to check if the SDK is ready (required for unit tests).
-
readyOrThrow
final Unit readyOrThrow()
Method used to check if the SDK is ready.
-
initialize
@Deprecated(message = "Use {@link #initialize(Application, DidomiInitializeParameters)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "this.initialize(Application, DidomiInitializeParameters)"))@JvmOverloads() final Unit initialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId, Boolean disableDidomiRemoteConfig, String languageCode, String noticeId)
Initialize the Didomi SDK and load its configuration. This method should be called from your Application onCreate method.
- Parameters:
application- The application instance; this is used to access resources within the application's file access and preferences.apiKey- Your API key.localConfigurationPath- Path to client specific config file in JSON format.remoteConfigurationUrl- URL to client specific remote config file in JSON format.providerId- Your provider ID (if any).disableDidomiRemoteConfig- Used to disable remote configuration.languageCode- Language in which the consent UI should be displayed.noticeId- ID of the notice configuration to load if your are not using app ID targeting
-
initialize
@Deprecated(message = "Use {@link #initialize(Application, DidomiInitializeParameters)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "this.initialize(Application, DidomiInitializeParameters)"))@JvmOverloads() final Unit initialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId, Boolean disableDidomiRemoteConfig, String languageCode)
Initialize the Didomi SDK and load its configuration. This method should be called from your Application onCreate method.
- Parameters:
application- The application instance; this is used to access resources within the application's file access and preferences.apiKey- Your API key.localConfigurationPath- Path to client specific config file in JSON format.remoteConfigurationUrl- URL to client specific remote config file in JSON format.providerId- Your provider ID (if any).disableDidomiRemoteConfig- Used to disable remote configuration.languageCode- Language in which the consent UI should be displayed.
-
initialize
@Deprecated(message = "Use {@link #initialize(Application, DidomiInitializeParameters)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "this.initialize(Application, DidomiInitializeParameters)"))@JvmOverloads() final Unit initialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId, Boolean disableDidomiRemoteConfig)
Initialize the Didomi SDK and load its configuration. This method should be called from your Application onCreate method.
- Parameters:
application- The application instance; this is used to access resources within the application's file access and preferences.apiKey- Your API key.localConfigurationPath- Path to client specific config file in JSON format.remoteConfigurationUrl- URL to client specific remote config file in JSON format.providerId- Your provider ID (if any).disableDidomiRemoteConfig- Used to disable remote configuration.
-
initialize
@Deprecated(message = "Use {@link #initialize(Application, DidomiInitializeParameters)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "this.initialize(Application, DidomiInitializeParameters)"))@JvmOverloads() final Unit initialize(Application application, String apiKey, String localConfigurationPath, String remoteConfigurationUrl, String providerId)
Initialize the Didomi SDK and load its configuration. This method should be called from your Application onCreate method.
- Parameters:
application- The application instance; this is used to access resources within the application's file access and preferences.apiKey- Your API key.localConfigurationPath- Path to client specific config file in JSON format.remoteConfigurationUrl- URL to client specific remote config file in JSON format.providerId- Your provider ID (if any).
-
initialize
final Unit initialize(Application application, DidomiInitializeParameters parameters)
Initialize the Didomi SDK and load its configuration. This method should be called from your Application onCreate method.
- Parameters:
application- The application instance; this is used to access resources within the application's file access and preferences.parameters- DidomiInitializeParameters object specifying parameters to initialize the SDK.
-
getPurpose
final Purpose getPurpose(String purposeId)
Get a purpose from its ID
-
shouldConsentBeCollected
final Boolean shouldConsentBeCollected()
Check if the consent should be collected depending on if we have any consents or if we have some consents but the number of days before displaying the notice again has not expired yet
-
getUserConsentStatusForPurpose
@Deprecated(message = "use {@link #getUserStatus()} instead. Search the purposeId in getUserStatus().getPurposes().getConsent().getEnabled() or getUserStatus().getPurposes().getConsent().getDisabled().") final Boolean getUserConsentStatusForPurpose(String purposeId)
Get the user consent status for a specific purpose
-
getUserLegitimateInterestStatusForPurpose
@Deprecated(message = "use {@link #getUserStatus()} instead. Search the purposeId in getUserStatus().getPurposes().getLegitimateInterest().getEnabled() or getUserStatus().getPurposes().getLegitimateInterest().getDisabled().") final Boolean getUserLegitimateInterestStatusForPurpose(String purposeId)
Get the user legitimate interest status for a specific purpose
-
getUserConsentStatusForVendor
@Deprecated(message = "use {@link #getUserStatus()} instead. Search the vendorId in getUserStatus().getVendors().getConsent().getEnabled() or getUserStatus().getVendors().getConsent().getDisabled().") final Boolean getUserConsentStatusForVendor(String vendorId)
Get the user consent status for a specific vendor
-
getUserLegitimateInterestStatusForVendor
@Deprecated(message = "use {@link #getUserStatus()} instead. Search the vendorId in getUserStatus().getVendors().getLegitimateInterest().getEnabled() or getUserStatus().getVendors().getLegitimateInterest().getDisabled().") final Boolean getUserLegitimateInterestStatusForVendor(String vendorId)
Get the user legitimate interest status for a specific vendor
-
getUserStatusForVendor
@Deprecated(message = "use {@link #getUserStatus()} instead. Search the vendorId in getUserStatus().getVendors().getGlobal().getEnabled() or getUserStatus().getVendors().getGlobal().getDisabled().") final Boolean getUserStatusForVendor(String vendorId)
Get the user consent and legitimate interest status for a specific vendor
-
getUserConsentStatusForVendorAndRequiredPurposes
@Deprecated(message = "use {@link #getUserStatus()} instead. Search the vendorId in getUserStatus().getVendors().getGlobalConsent().getEnabled() or getUserStatus().getVendors().getGlobalConsent().getDisabled().") final Boolean getUserConsentStatusForVendorAndRequiredPurposes(String vendorId)
Check if a vendor has consent for all the purposes that it requires
-
getUserLegitimateInterestStatusForVendorAndRequiredPurposes
@Deprecated(message = "use {@link #getUserStatus()} instead. Search the vendorId in getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or getUserStatus().getVendors().getGlobalLegitimateInterest().getDisabled().") final Boolean getUserLegitimateInterestStatusForVendorAndRequiredPurposes(String vendorId)
Check if a vendor has consent for all the legitimate interest purposes that it requires
-
setUserAgreeToAll
final Boolean setUserAgreeToAll()
Enable all purposes and vendors for the user.
-
setUserDisagreeToAll
final Boolean setUserDisagreeToAll()
Update user status to disagree : disable consent and legitimate interest purposes, disable consent vendors, but still enable legitimate interest vendors.
-
setUserConsentStatus
@Deprecated(message = "Use {@link #setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "setUserStatus(enabledPurposeIds, disabledPurposeIds, enabledLegitimatePurposeIds, disabledLegitimatePurposeIds, enabledVendorIds, disabledVendorIds, enabledLegIntVendorIds, disabledLegIntVendorIds)")) final Boolean setUserConsentStatus(Set<String> enabledPurposeIds, Set<String> disabledPurposeIds, Set<String> enabledLegitimatePurposeIds, Set<String> disabledLegitimatePurposeIds, Set<String> enabledVendorIds, Set<String> disabledVendorIds, Set<String> enabledLegIntVendorIds, Set<String> disabledLegIntVendorIds)
-
setUserStatus
@Deprecated(message = "This internal function should not be used, use {@link #setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "setUserStatus(enabledPurposeIds, disabledPurposeIds, enabledLegitimatePurposeIds, disabledLegitimatePurposeIds, enabledVendorIds, disabledVendorIds, enabledLegIntVendorIds, disabledLegIntVendorIds)")) final Boolean setUserStatus(Set<String> enabledConsentPurposeIds, Set<String> disabledConsentPurposeIds, Set<String> enabledLIPurposeIds, Set<String> disabledLIPurposeIds, Set<String> enabledConsentVendorIds, Set<String> disabledConsentVendorIds, Set<String> enabledLIVendorIds, Set<String> disabledLIVendorIds, Boolean sendAPIEvent)
-
setUserStatus
final Boolean setUserStatus(Set<String> enabledConsentPurposeIds, Set<String> disabledConsentPurposeIds, Set<String> enabledLIPurposeIds, Set<String> disabledLIPurposeIds, Set<String> enabledConsentVendorIds, Set<String> disabledConsentVendorIds, Set<String> enabledLIVendorIds, Set<String> disabledLIVendorIds)
Set the user status for each purpose and vendor
- Parameters:
enabledConsentPurposeIds- ids of the consent purposes to enabledisabledConsentPurposeIds- ids of the consent purposes to disableenabledLIPurposeIds- ids of the legitimate interest purposes to enabledisabledLIPurposeIds- ids of the legitimate interest purposes to disableenabledConsentVendorIds- ids of the consent vendors to enabledisabledConsentVendorIds- ids of the consent vendors to disableenabledLIVendorIds- ids of the legitimate interest vendors to enabledisabledLIVendorIds- ids of the legitimate interest vendors to disable
-
setUserStatus
final Boolean setUserStatus(Boolean purposesConsentStatus, Boolean purposesLIStatus, Boolean vendorsConsentStatus, Boolean vendorsLIStatus)
Set the user status globally
- Parameters:
purposesConsentStatus- true if purposes on a consent basis should be enabled, false if they should be disabledpurposesLIStatus- true if purposes on a legitimate interest basis should be enabled, false if they should be disabledvendorsConsentStatus- true if vendors on a consent basis should be enabled, false if they should be disabledvendorsLIStatus- true if vendors on a legitimate interest basis should be enabled, false if they should be disabled
-
setUserConsentStatusFromObjects
@Deprecated(message = "Use {@link #setUserStatusFromObjects(Set, Set, Set, Set, Set, Set, Set, Set)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "setUserStatusFromObjects(enabledPurposes, disabledPurposes, enabledLegitimatePurposes, disabledLegitimatePurposes, enabledVendors, disabledVendors, enabledLegIntVendors, disabledLegIntVendors")) final Boolean setUserConsentStatusFromObjects(Set<Purpose> enabledPurposes, Set<Purpose> disabledPurposes, Set<Purpose> enabledLegitimatePurposes, Set<Purpose> disabledLegitimatePurposes, Set<Vendor> enabledVendors, Set<Vendor> disabledVendors, Set<Vendor> enabledLegIntVendors, Set<Vendor> disabledLegIntVendors)
-
setUserStatusFromObjects
@Deprecated(message = "This internal function should not be used, use {@link #setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)} instead")@JvmOverloads() final Boolean setUserStatusFromObjects(Set<Purpose> enabledConsentPurposes, Set<Purpose> disabledConsentPurposes, Set<Purpose> enabledLIPurposes, Set<Purpose> disabledLIPurposes, Set<Vendor> enabledConsentVendors, Set<Vendor> disabledConsentVendors, Set<Vendor> enabledLIVendors, Set<Vendor> disabledLIVendors, Boolean sendAPIEvent)
-
setUserStatusFromObjects
@Deprecated(message = "This internal function should not be used, use {@link #setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)} instead")@JvmOverloads() final Boolean setUserStatusFromObjects(Set<Purpose> enabledConsentPurposes, Set<Purpose> disabledConsentPurposes, Set<Purpose> enabledLIPurposes, Set<Purpose> disabledLIPurposes, Set<Vendor> enabledConsentVendors, Set<Vendor> disabledConsentVendors, Set<Vendor> enabledLIVendors, Set<Vendor> disabledLIVendors)
-
reset
final Unit reset()
Remove all consents and user information from the SDK. If SDK is not ready, the reset will be performed during initialization.
-
onReady
final Unit onReady(DidomiCallable callback)
Provide a function that needs to be called once the SDK is ready Automatically call the function if the SDK is already ready (that's why this is not a standard event)
- Parameters:
callback- that is called once the SDK is ready.
-
onError
final Unit onError(DidomiCallable callback)
Provide a function that needs to be called if the SDK encounters an error during initialization. In this case, the SDK will never be ready and onReady will not be called. Automatically call the function if the SDK initialization has already failed
- Parameters:
callback- that is called if the SDK encounters an error
-
addEventListener
final Unit addEventListener(EventListener listener)
Add an event listener
- Parameters:
listener- the EventListener to add
-
addEventListener
final Unit addEventListener(DidomiEventListener listener)
Add an event listener
- Parameters:
listener- the DidomiEventListener to add
-
removeEventListener
final Unit removeEventListener(DidomiEventListener listener)
Remove a previously added event listener
- Parameters:
listener- the DidomiEventListener to remove
-
setupUI
final Unit setupUI(FragmentActivity activity)
Show the consent notice if required (ie if consent information is missing)
This does not show the consent notice if all consent information is already available as consent was previously collected.
This method should be called in the onCreate function of your main activity or in activities where you want the consent notice to be shown to the user. This should be called at least once on every app launch and should cover every path by which the user launches the app (including deep linking) to ensure that consent is collected as often as possible.
-
forceShowNotice
final Unit forceShowNotice(FragmentActivity activity)
Force show the consent notice without checking if consent is required
- Parameters:
activity- base activity to use for notice
-
showNotice
final Unit showNotice(FragmentActivity activity)
Show the consent notice (if required, not disabled in the config and not already displayed)
- Parameters:
activity- base activity to use for notice
-
hideNotice
final Unit hideNotice()
Hide the notice if it is currently displayed
-
isNoticeVisible
final Boolean isNoticeVisible()
Check if the consent notice is currently displayed
-
showPreferences
@JvmOverloads() final Unit showPreferences(FragmentActivity activity, String view)
Method used to show the preferences view, by previously updating the fragment manager property based on an activity. It also specifies which view (vendors or purposes) opens first.
- Parameters:
activity- activity used to get the support fragment manager.view- view to show to the user (purposes or vendors).
-
showPreferences
@JvmOverloads() final Unit showPreferences(FragmentActivity activity)
Method used to show the preferences view, by previously updating the fragment manager property based on an activity. It also specifies which view (vendors or purposes) opens first.
- Parameters:
activity- activity used to get the support fragment manager.
-
hidePreferences
final Unit hidePreferences()
Hide the Preferences dialog
-
isPreferencesVisible
final Boolean isPreferencesVisible()
Check if the Preferences view is currently displayed
-
updateSelectedLanguage
final Unit updateSelectedLanguage(String languageCode)
Update the selected language of the Didomi SDK and any property that depends on it. In most cases this method doesn't need to be called. It would only be required for those apps that allow language change on-the-fly, i.e.: from within the app rather than from the device settings. In order to update the language of the views displayed by the Didomi SDK, this method needs to be called before these views are displayed.
- Parameters:
languageCode-international short code (Coded2) for selected language.
-
getText
final Map<String, String> getText(String key)
Method used to get a dictionary/map for a given key in the form of { en: "Value in English", fr: "Value in French" } from the didomi_config.json file containing translations in different languages.
The keys and values considered come from different places in the didomi_config.json file such as { notice: ... }, { preferences: ... } and { texts: ... }, giving the latter the highest priority in case of duplicates.
- Parameters:
key- string used as a key to find a dictionary/map that contains translation texts.
-
getTranslatedText
final String getTranslatedText(String key)
Method used to get a translated string for a given key from the didomi_config.json file based on the currently selected language.
The keys and values considered come from different places in the didomi_config.json file such as { notice: ... }, { preferences: ... } and { texts: ... }, giving the latter the highest priority in case of duplicates.
- Parameters:
key- string used as a key to find a translated string.
-
getJavaScriptForWebView
@JvmOverloads() final String getJavaScriptForWebView(String extra)
Get JavaScript to embed into a WebView to pass the consent status from the app to the Didomi Web SDK embedded into the WebView
Inject the returned tag into a WebView with
evaluateJavaScript.See https://developers.didomi.io/cmp/mobile-sdk/share-consent-with-webviews for more information.
- Parameters:
extra- Extra JavaScript to inject in the returned tag (or null)
-
getJavaScriptForWebView
@JvmOverloads() final String getJavaScriptForWebView()
Get JavaScript to embed into a WebView to pass the consent status from the app to the Didomi Web SDK embedded into the WebView
Inject the returned tag into a WebView with
evaluateJavaScript.See https://developers.didomi.io/cmp/mobile-sdk/share-consent-with-webviews for more information.
-
setUserAgent
final Unit setUserAgent(String name, String version)
Set custom user agent name and version
-
setUser
@Deprecated(message = "Use {@link #setUser(UserAuthParams)} instead", replaceWith = @ReplaceWith(imports = {}, expression = "setUser(UserAuthWithHashParams(id = organizationUserId, algorithm = organizationUserIdAuthAlgorithm, secretId = organizationUserIdAuthSid, digest = organizationUserIdAuthDigest, salt = organizationUserIdAuthSalt, expiration = null))")) final Unit setUser(String organizationUserId, String organizationUserIdAuthAlgorithm, String organizationUserIdAuthSid, String organizationUserIdAuthSalt, String organizationUserIdAuthDigest)
Set user information with authentication
- Parameters:
organizationUserId- Organization user IDorganizationUserIdAuthAlgorithm- Algorithm used for computing the digestorganizationUserIdAuthSid- ID of the secret used for computing the digestorganizationUserIdAuthSalt- Salt used for computing the digest (optional)organizationUserIdAuthDigest- Digest of the organization user ID and secret
-
setUser
@JvmOverloads() final Unit setUser(String organizationUserId, FragmentActivity activity)
Set user information
- Parameters:
organizationUserId- Organization user IDactivity- Current activity, so notice is displayed if it is needed after synchronization
-
setUser
@JvmOverloads() final Unit setUser(String organizationUserId)
Set user information
- Parameters:
organizationUserId- Organization user ID
-
setUser
@JvmOverloads() final Unit setUser(UserAuthParams userAuthParams, FragmentActivity activity)
Set user information with authentication
- Parameters:
userAuthParams- User authentication parametersactivity- Current activity, so notice is displayed if it is needed after synchronization
-
setUser
@JvmOverloads() final Unit setUser(UserAuthParams userAuthParams)
Set user information with authentication
- Parameters:
userAuthParams- User authentication parameters
-
sync
final Boolean sync(Boolean blocking, FragmentActivity activity)
Sync the user information with the remote status
- Parameters:
blocking- Whether the sync process should block the thread or not.activity- Current activity, so we can call setupUI when synchronization is done
-
syncIfRequired
final Unit syncIfRequired(FragmentActivity activity)
Refresh the user status from the backend if the SDK is ready
-
setLocalProperty
final Unit setLocalProperty(String key, Object value)
Internal use only. Can activate specific features currently in development.
-
-
-
-