public class Didomi
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
VIEW_PURPOSES |
static java.lang.String |
VIEW_VENDORS |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(DidomiEventListener listener)
Add an event listener
|
void |
addEventListener(EventListener listener)
Add an event listener
|
static void |
clearInstance()
Internal use only. Clear the Didomi instance so it is possible to initialize it again.
|
void |
forceShowNotice(androidx.fragment.app.FragmentActivity activity)
Force show the consent notice without checking if consent is required
|
ApiEventsRepository |
getApiEventsRepository()
Getter method for apiEventsRepository property.
|
ConfigurationRepository |
getConfigurationRepository()
Getter for configurationRepository property.
|
ConsentRepository |
getConsentRepository()
Getter method for consentRepository property.
|
ContextHelper |
getContextHelper()
Getter method for context helper.
|
CountryHelper |
getCountryHelper()
Getter method for countryHelper property.
|
java.util.Set<java.lang.String> |
getDisabledPurposeIds()
Get the IDs of the disabled purposes
|
java.util.Set<Purpose> |
getDisabledPurposes()
Get the disabled purposes
|
java.util.Set<java.lang.String> |
getDisabledVendorIds()
Get the IDs of the disabled vendors
|
java.util.Set<Vendor> |
getDisabledVendors()
Get the disabled vendors
|
java.util.Set<java.lang.String> |
getEnabledPurposeIds()
Get the IDs of the enabled purposes
|
java.util.Set<Purpose> |
getEnabledPurposes()
Get the enabled purposes
|
java.util.Set<java.lang.String> |
getEnabledVendorIds()
Get the IDs of the enabled vendors
|
java.util.Set<Vendor> |
getEnabledVendors()
Get the enabled vendors
|
EventsRepository |
getEventsRepository()
Getter method for eventsRepository.
|
static Didomi |
getInstance()
Get the global singleton instance of the Didomi SDK
This should not be used internally (inject dependencies instead of referencing them globally) except for UI views
|
java.lang.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
|
java.lang.String |
getJavaScriptForWebView(java.lang.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
|
io.didomi.sdk.resources.LanguagesHelper |
getLanguagesHelper()
Method used to get the language helper.
|
int |
getLogoResourceId()
Get the logo resource id
|
io.didomi.sdk.user.OrganizationUserRepository |
getOrganizationUserRepository()
Getter method for organizationUserRepository
|
Purpose |
getPurpose(java.lang.String purposeId)
Get a purpose from its ID
|
java.lang.String |
getQueryStringForWebView()
Get a query-string to add to the URL of a WebView or Chrome Custom Tab to pass
the consent status from the app to the Didomi Web SDK embedded on the target URL.
|
java.util.Set<java.lang.String> |
getRequiredPurposeIds()
Get the configured purpose IDs
|
java.util.Set<Purpose> |
getRequiredPurposes()
Get the configured purposes
|
java.util.Set<java.lang.String> |
getRequiredVendorIds()
Get the configured vendor IDs
|
java.util.Set<Vendor> |
getRequiredVendors()
Get the configured vendors
|
io.didomi.sdk.resources.ResourcesHelper |
getResourcesHelper()
Retrieve ResourcesHelper used to handle device resources
|
java.util.Map<java.lang.String,java.lang.String> |
getText(java.lang.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.
|
java.lang.String |
getTranslatedText(java.lang.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.
|
io.didomi.sdk.ui.UIStateRepository |
getUiStateRepository()
Internal use only. Used to handle some UI state parameters.
|
java.lang.Boolean |
getUserConsentStatusForPurpose(java.lang.String purposeId)
Get the user consent status for a specific purpose
|
java.lang.Boolean |
getUserConsentStatusForVendor(java.lang.String vendorId)
Get the user consent status for a specific vendor
|
java.lang.Boolean |
getUserConsentStatusForVendorAndRequiredPurposes(java.lang.String vendorId)
Check if a vendor has consent for all the purposes that it requires
|
java.lang.Boolean |
getUserLegitimateInterestStatusForPurpose(java.lang.String purposeId)
Get the user legitimate interest status for a specific purpose
|
java.lang.Boolean |
getUserLegitimateInterestStatusForVendor(java.lang.String vendorId)
Get the user legitimate interest status for a specific vendor
|
boolean |
getUserLegitimateInterestStatusForVendorAndRequiredPurposes(java.lang.String vendorId)
Check if a vendor has consent for all the legitimate interest purposes that it requires
|
io.didomi.sdk.user.UserRepository |
getUserRepository()
Getter for UserRepository property.
|
boolean |
getUserStatusForVendor(java.lang.String vendorId)
Get the user consent and legitimate interest status for a specific vendor
|
Vendor |
getVendor(java.lang.String vendorId)
Get a vendor from its ID
|
boolean |
hasAnyStatus()
Check if we have collected any status (consent or legitimate interest) from the user
|
void |
hideNotice()
Hide the notice if it is currently displayed
|
void |
hidePreferences()
Hide the Preferences dialog
|
void |
initialize(android.app.Application application,
java.lang.String apiKey,
java.lang.String localConfigurationPath,
java.lang.String remoteConfigurationURL,
java.lang.String providerId)
Initialize the Didomi SDK and load its configuration.
|
void |
initialize(android.app.Application application,
java.lang.String apiKey,
java.lang.String localConfigurationPath,
java.lang.String remoteConfigurationURL,
java.lang.String providerId,
java.lang.Boolean disableDidomiRemoteConfig)
Initialize the Didomi SDK and load its configuration.
|
void |
initialize(android.app.Application application,
java.lang.String apiKey,
java.lang.String localConfigurationPath,
java.lang.String remoteConfigurationURL,
java.lang.String providerId,
java.lang.Boolean disableDidomiRemoteConfig,
java.lang.String languageCode)
Initialize the Didomi SDK and load its configuration.
|
void |
initialize(android.app.Application application,
java.lang.String apiKey,
java.lang.String localConfigurationPath,
java.lang.String remoteConfigurationURL,
java.lang.String providerId,
java.lang.Boolean disableDidomiRemoteConfig,
java.lang.String languageCode,
java.lang.String noticeId)
Initialize the Didomi SDK and load its configuration.
|
boolean |
isConsentRequired()
Determine if consent is required for the user.
|
boolean |
isError()
Has the Didomi SDK encountered an error ?
|
boolean |
isInitialized()
Is the Didomi SDK initialized?
This is set to `true` immediately after the call to `initialize()`.
|
boolean |
isNoticeVisible()
Check if the consent notice is currently displayed
|
boolean |
isPreferencesVisible()
Check if the Preferences view is currently displayed
|
boolean |
isReady()
Is the Didomi SDK ready?
|
boolean |
isUserConsentStatusPartial()
Determine if consent information is available for all purposes and vendors that are required
|
boolean |
isUserLegitimateInterestStatusPartial()
Determine if legitimate interest information is available for all purposes and vendors that are required
|
boolean |
isUserStatusPartial()
Check if consent or legitimate interest status is partial
|
void |
onError(DidomiCallable callback)
Provide a function that needs to be called if the SDK encounters an error during initialization.
|
void |
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)
|
void |
removeEventListener(DidomiEventListener listener)
Remove a previously added event listener
|
void |
reset()
Remove all consents for the user
|
void |
setConsentRepository(ConsentRepository consentRepository) |
void |
setContextHelper(ContextHelper contextHelper) |
void |
setLogLevel(int minLevel)
Set the minimum level of messages to log
|
void |
setupUI(androidx.fragment.app.FragmentActivity activity)
Show the consent notice if required (ie if consent information is missing)
|
void |
setUser(java.lang.String organizationUserId)
Set user information
|
void |
setUser(java.lang.String organizationUserId,
java.lang.String organizationUserIdAuthAlgorithm,
java.lang.String organizationUserIdAuthSid,
java.lang.String organizationUserIdAuthSalt,
java.lang.String organizationUserIdAuthDigest)
Set user information with authentication
|
void |
setUserAgent(java.lang.String name,
java.lang.String version)
Set custom user agent name and version
|
boolean |
setUserAgreeToAll()
Enable all purposes and vendors for the user.
|
boolean |
setUserConsentStatus(java.util.Set<java.lang.String> enabledPurposeIds,
java.util.Set<java.lang.String> disabledPurposeIds,
java.util.Set<java.lang.String> enabledLegitimatePurposeIds,
java.util.Set<java.lang.String> disabledLegitimatePurposeIds,
java.util.Set<java.lang.String> enabledVendorIds,
java.util.Set<java.lang.String> disabledVendorIds,
java.util.Set<java.lang.String> enabledLegIntVendorIds,
java.util.Set<java.lang.String> disabledLegIntVendorIds)
Deprecated.
|
boolean |
setUserConsentStatusFromObjects(java.util.Set<Purpose> enabledPurposes,
java.util.Set<Purpose> disabledPurposes,
java.util.Set<Purpose> enabledLegitimatePurposes,
java.util.Set<Purpose> disabledLegitimatePurposes,
java.util.Set<Vendor> enabledVendors,
java.util.Set<Vendor> disabledVendors,
java.util.Set<Vendor> enabledLegIntVendors,
java.util.Set<Vendor> disabledLegIntVendors)
Deprecated.
|
boolean |
setUserDisagreeToAll()
Update user status to disagree : disable consent and legitimate interest purposes, disable consent vendors, but still enable legitimate interest vendors.
|
boolean |
setUserStatus(boolean purposesConsentStatus,
boolean purposesLIStatus,
boolean vendorsConsentStatus,
boolean vendorsLIStatus)
Set the user status globally
|
boolean |
setUserStatus(java.util.Set<java.lang.String> enabledConsentPurposeIds,
java.util.Set<java.lang.String> disabledConsentPurposeIds,
java.util.Set<java.lang.String> enabledLIPurposeIds,
java.util.Set<java.lang.String> disabledLIPurposeIds,
java.util.Set<java.lang.String> enabledConsentVendorIds,
java.util.Set<java.lang.String> disabledConsentVendorIds,
java.util.Set<java.lang.String> enabledLIVendorIds,
java.util.Set<java.lang.String> disabledLIVendorIds)
Set the user status
|
boolean |
setUserStatus(java.util.Set<java.lang.String> enabledConsentPurposeIds,
java.util.Set<java.lang.String> disabledConsentPurposeIds,
java.util.Set<java.lang.String> enabledLIPurposeIds,
java.util.Set<java.lang.String> disabledLIPurposeIds,
java.util.Set<java.lang.String> enabledConsentVendorIds,
java.util.Set<java.lang.String> disabledConsentVendorIds,
java.util.Set<java.lang.String> enabledLIVendorIds,
java.util.Set<java.lang.String> disabledLIVendorIds,
boolean sendAPIEvent)
Set the user status
|
boolean |
setUserStatusFromObjects(java.util.Set<Purpose> enabledConsentPurposes,
java.util.Set<Purpose> disabledConsentPurposes,
java.util.Set<Purpose> enabledLIPurposes,
java.util.Set<Purpose> disabledLIPurposes,
java.util.Set<Vendor> enabledConsentVendors,
java.util.Set<Vendor> disabledConsentVendors,
java.util.Set<Vendor> enabledLIVendors,
java.util.Set<Vendor> disabledLIVendors)
Set the user status with Purpose/Vendor objects
|
boolean |
setUserStatusFromObjects(java.util.Set<Purpose> enabledConsentPurposes,
java.util.Set<Purpose> disabledConsentPurposes,
java.util.Set<Purpose> enabledLIPurposes,
java.util.Set<Purpose> disabledLIPurposes,
java.util.Set<Vendor> enabledConsentVendors,
java.util.Set<Vendor> disabledConsentVendors,
java.util.Set<Vendor> enabledLIVendors,
java.util.Set<Vendor> disabledLIVendors,
boolean sendAPIEvent)
Set the user status with Purpose/Vendor objects
|
void |
setVendorRepository(VendorRepository vendorRepository) |
void |
setVendorsInfoProvider(io.didomi.sdk.vendors.VendorsInfoProvider vendorsInfoProvider) |
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
|
void |
showNotice(androidx.fragment.app.FragmentActivity activity)
Show the consent notice (if required, not disabled in the config and not already displayed)
|
void |
showPreferences(androidx.fragment.app.FragmentActivity activity)
Show the Preferences dialog on the Purposes view
|
void |
showPreferences(androidx.fragment.app.FragmentActivity activity,
java.lang.String view)
Method used to show the preferences view, by previously updating the fragment manager property based on an activity.
|
void |
updateSelectedLanguage(java.lang.String languageCode)
Update the selected language of the Didomi SDK and any property that depends on it.
|
public static final java.lang.String VIEW_PURPOSES
public static final java.lang.String VIEW_VENDORS
public static Didomi getInstance()
public static void clearInstance()
public void setLogLevel(int minLevel)
Messages with a level below `minLevel` will not be logged. Levels are standard levels from `android.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.WARN` in production
minLevel - Minimum level of messages to logpublic int getLogoResourceId()
public void setVendorsInfoProvider(io.didomi.sdk.vendors.VendorsInfoProvider vendorsInfoProvider)
public void setContextHelper(ContextHelper contextHelper)
public EventsRepository getEventsRepository() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public io.didomi.sdk.user.OrganizationUserRepository getOrganizationUserRepository()
public void setVendorRepository(VendorRepository vendorRepository)
public void initialize(android.app.Application application,
java.lang.String apiKey,
@Nullable
java.lang.String localConfigurationPath,
@Nullable
java.lang.String remoteConfigurationURL,
@Nullable
java.lang.String providerId,
java.lang.Boolean disableDidomiRemoteConfig,
java.lang.String languageCode)
throws java.lang.Exception
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. If not specified, by defalut is set as didomi_config.json in the app assets.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. By default,
the consent UI is displayed in the language configured in the device settings, if langauge is availabe and enabled by your configuration.
This property allows you to override the default setting and specify a language to display the UI in. String containing the language code e.g.: "es", "fr", etc.java.lang.Exceptionpublic void initialize(android.app.Application application,
java.lang.String apiKey,
@Nullable
java.lang.String localConfigurationPath,
@Nullable
java.lang.String remoteConfigurationURL,
@Nullable
java.lang.String providerId,
java.lang.Boolean disableDidomiRemoteConfig,
java.lang.String languageCode,
java.lang.String noticeId)
throws java.lang.Exception
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. If not specified, by defalut is set as didomi_config.json in the app assets.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. By default,
the consent UI is displayed in the language configured in the device settings, if langauge is availabe and enabled by your configuration.
This property allows you to override the default setting and specify a language to display the UI in. String containing the language code e.g.: "es", "fr", etc.noticeId - ID of the notice configuration to load if your are not using app ID targetingjava.lang.Exceptionpublic void initialize(android.app.Application application,
java.lang.String apiKey,
@Nullable
java.lang.String localConfigurationPath,
@Nullable
java.lang.String remoteConfigurationURL,
@Nullable
java.lang.String providerId,
java.lang.Boolean disableDidomiRemoteConfig)
throws java.lang.Exception
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. If not specified, by defalut is set as didomi_config.json in the app assets.remoteConfigurationURL - URL to client specific remote config file in JSON format.providerId - Your provider ID (if any).disableDidomiRemoteConfig - Used to disable remote configuration.java.lang.Exceptionpublic void initialize(android.app.Application application,
java.lang.String apiKey,
@Nullable
java.lang.String localConfigurationPath,
@Nullable
java.lang.String remoteConfigurationURL,
@Nullable
java.lang.String providerId)
throws java.lang.Exception
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. If not specified, by defalut is set as didomi_config.json in the app assets.remoteConfigurationURL - URL to client specific remote config file in JSON format.providerId - Your provider ID (if any).java.lang.Exceptionpublic io.didomi.sdk.resources.LanguagesHelper getLanguagesHelper()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public io.didomi.sdk.resources.ResourcesHelper getResourcesHelper()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public io.didomi.sdk.ui.UIStateRepository getUiStateRepository()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean isConsentRequired()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean isUserConsentStatusPartial()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean isUserLegitimateInterestStatusPartial()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean isUserStatusPartial()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.@Nullable
public java.lang.Boolean getUserConsentStatusForVendor(java.lang.String vendorId)
throws DidomiNotReadyException
vendorId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.lang.Boolean getUserLegitimateInterestStatusForVendor(java.lang.String vendorId)
throws DidomiNotReadyException
vendorId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean getUserStatusForVendor(java.lang.String vendorId)
throws DidomiNotReadyException
vendorId - DidomiNotReadyException@Nullable
public java.lang.Boolean getUserConsentStatusForPurpose(java.lang.String purposeId)
throws DidomiNotReadyException
purposeId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.lang.Boolean getUserLegitimateInterestStatusForPurpose(java.lang.String purposeId)
throws DidomiNotReadyException
purposeId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.lang.Boolean getUserConsentStatusForVendorAndRequiredPurposes(java.lang.String vendorId)
throws DidomiNotReadyException
vendorId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean getUserLegitimateInterestStatusForVendorAndRequiredPurposes(java.lang.String vendorId)
throws DidomiNotReadyException
vendorId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean setUserAgreeToAll()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean setUserDisagreeToAll()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean setUserStatus(boolean purposesConsentStatus,
boolean purposesLIStatus,
boolean vendorsConsentStatus,
boolean vendorsLIStatus)
throws DidomiNotReadyException
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 disabledDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.@Deprecated
public boolean setUserConsentStatus(java.util.Set<java.lang.String> enabledPurposeIds,
java.util.Set<java.lang.String> disabledPurposeIds,
java.util.Set<java.lang.String> enabledLegitimatePurposeIds,
java.util.Set<java.lang.String> disabledLegitimatePurposeIds,
java.util.Set<java.lang.String> enabledVendorIds,
java.util.Set<java.lang.String> disabledVendorIds,
java.util.Set<java.lang.String> enabledLegIntVendorIds,
java.util.Set<java.lang.String> disabledLegIntVendorIds)
throws DidomiNotReadyException
setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set) insteadDidomiNotReadyExceptionsetUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)public boolean setUserStatus(java.util.Set<java.lang.String> enabledConsentPurposeIds,
java.util.Set<java.lang.String> disabledConsentPurposeIds,
java.util.Set<java.lang.String> enabledLIPurposeIds,
java.util.Set<java.lang.String> disabledLIPurposeIds,
java.util.Set<java.lang.String> enabledConsentVendorIds,
java.util.Set<java.lang.String> disabledConsentVendorIds,
java.util.Set<java.lang.String> enabledLIVendorIds,
java.util.Set<java.lang.String> disabledLIVendorIds,
boolean sendAPIEvent)
throws DidomiNotReadyException
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 disablesendAPIEvent - Whether to send an event to the API to report a user choiceDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean setUserStatus(java.util.Set<java.lang.String> enabledConsentPurposeIds,
java.util.Set<java.lang.String> disabledConsentPurposeIds,
java.util.Set<java.lang.String> enabledLIPurposeIds,
java.util.Set<java.lang.String> disabledLIPurposeIds,
java.util.Set<java.lang.String> enabledConsentVendorIds,
java.util.Set<java.lang.String> disabledConsentVendorIds,
java.util.Set<java.lang.String> enabledLIVendorIds,
java.util.Set<java.lang.String> disabledLIVendorIds)
throws DidomiNotReadyException
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 disableDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.@Deprecated public boolean setUserConsentStatusFromObjects(java.util.Set<Purpose> enabledPurposes, java.util.Set<Purpose> disabledPurposes, java.util.Set<Purpose> enabledLegitimatePurposes, java.util.Set<Purpose> disabledLegitimatePurposes, java.util.Set<Vendor> enabledVendors, java.util.Set<Vendor> disabledVendors, java.util.Set<Vendor> enabledLegIntVendors, java.util.Set<Vendor> disabledLegIntVendors) throws DidomiNotReadyException
setUserStatusFromObjects(Set, Set, Set, Set, Set, Set, Set, Set) insteadpublic boolean setUserStatusFromObjects(java.util.Set<Purpose> enabledConsentPurposes, java.util.Set<Purpose> disabledConsentPurposes, java.util.Set<Purpose> enabledLIPurposes, java.util.Set<Purpose> disabledLIPurposes, java.util.Set<Vendor> enabledConsentVendors, java.util.Set<Vendor> disabledConsentVendors, java.util.Set<Vendor> enabledLIVendors, java.util.Set<Vendor> disabledLIVendors) throws DidomiNotReadyException
This function is also responsible for triggering the app and API events so all consent changes have to go through it. Direct calls to the ConsentRepository will not trigger those events.
enabledConsentPurposes - Consent purposes to enabledisabledConsentPurposes - Consent purposes to disableenabledLIPurposes - Legitimate interest purposes to enabledisabledLIPurposes - Legitimate interest purposes to disableenabledConsentVendors - Consent vendors to enabledisabledConsentVendors - Consent vendors to disableenabledLIVendors - Legitimate interest vendors to enabledisabledLIVendors - Legitimate interest vendors do disableDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean setUserStatusFromObjects(java.util.Set<Purpose> enabledConsentPurposes, java.util.Set<Purpose> disabledConsentPurposes, java.util.Set<Purpose> enabledLIPurposes, java.util.Set<Purpose> disabledLIPurposes, java.util.Set<Vendor> enabledConsentVendors, java.util.Set<Vendor> disabledConsentVendors, java.util.Set<Vendor> enabledLIVendors, java.util.Set<Vendor> disabledLIVendors, boolean sendAPIEvent) throws DidomiNotReadyException
This function is also responsible for triggering the app and API events so all consent changes have to go through it. Direct calls to the ConsentRepository will not trigger those events.
enabledConsentPurposes - Consent purposes to enabledisabledConsentPurposes - Consent purposes to disableenabledLIPurposes - Legitimate interest purposes to enabledisabledLIPurposes - Legitimate interest purposes to disableenabledConsentVendors - Consent vendors to enabledisabledConsentVendors - Consent vendors to disableenabledLIVendors - Legitimate interest vendors to enabledisabledLIVendors - Legitimate interest vendors do disablesendAPIEvent - Whether to send an event to the API to report a user choiceDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public ConfigurationRepository getConfigurationRepository() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public ConsentRepository getConsentRepository() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void setConsentRepository(ConsentRepository consentRepository)
public CountryHelper getCountryHelper() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public ContextHelper getContextHelper() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public ApiEventsRepository getApiEventsRepository() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public io.didomi.sdk.user.UserRepository getUserRepository()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void addEventListener(EventListener listener)
listener - the EventListener to addpublic void addEventListener(DidomiEventListener listener)
listener - the DidomiEventListener to addpublic void removeEventListener(DidomiEventListener listener)
listener - the DidomiEventListener to removepublic void setupUI(androidx.fragment.app.FragmentActivity activity)
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.
public void forceShowNotice(androidx.fragment.app.FragmentActivity activity)
throws DidomiNotReadyException
activity - base activity to use for noticeDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void showNotice(androidx.fragment.app.FragmentActivity activity)
throws DidomiNotReadyException
activity - base activity to use for noticeDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void hideNotice()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean isNoticeVisible()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean shouldConsentBeCollected()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void showPreferences(androidx.fragment.app.FragmentActivity activity)
throws DidomiNotReadyException
activity - activity used to get the support fragment manager.DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void showPreferences(androidx.fragment.app.FragmentActivity activity,
java.lang.String view)
throws DidomiNotReadyException
activity - activity used to get the support fragment manager.view - view to show to the user (purposes or vendors).DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void hidePreferences()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean isPreferencesVisible()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public boolean isReady()
public boolean isError()
public boolean isInitialized()
public void onReady(DidomiCallable callback) throws java.lang.Exception
callback - that is called once the SDK is ready.java.lang.Exceptionpublic void onError(DidomiCallable callback) throws java.lang.Exception
callback - that is called if the SDK encounters an errorjava.lang.Exceptionpublic void reset()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<java.lang.String> getRequiredPurposeIds()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<java.lang.String> getRequiredVendorIds()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<Purpose> getRequiredPurposes() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<Vendor> getRequiredVendors() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<Purpose> getEnabledPurposes() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<java.lang.String> getEnabledPurposeIds()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<Purpose> getDisabledPurposes() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<java.lang.String> getDisabledPurposeIds()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<Vendor> getEnabledVendors() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<java.lang.String> getEnabledVendorIds()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<Vendor> getDisabledVendors() throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Set<java.lang.String> getDisabledVendorIds()
throws DidomiNotReadyException
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public Purpose getPurpose(java.lang.String purposeId) throws DidomiNotReadyException
purposeId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public Vendor getVendor(java.lang.String vendorId) throws DidomiNotReadyException
vendorId - DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.lang.String getJavaScriptForWebView(java.lang.String extra)
throws DidomiNotReadyException
Inject the returned tag into a WebView with `evaluateJavaScript`.
See https://developers.didomi.io/cmp/mobile-sdk/share-consent-with-webviews for more information.
extra - Extra JavaScript to inject in the returned tagDidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.lang.String getQueryStringForWebView()
throws DidomiNotReadyException
The returned parameter will have the format `didomiConfig.user.externalConsent.value=...`. It includes the user consent information URL-encoded and JSON-encoded. Append the returned query-string parameter to the URL of your WebView or Chrome Custom Tab.
See https://developers.didomi.io/cmp/mobile-sdk/share-consent-with-webviews for more information.
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.lang.String getJavaScriptForWebView()
throws DidomiNotReadyException
Inject the returned tag into a WebView with `evaluateJavaScript`
DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void updateSelectedLanguage(java.lang.String languageCode)
throws DidomiNotReadyException
languageCode - - international short code (Coded2) for selected language.DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.util.Map<java.lang.String,java.lang.String> getText(java.lang.String key)
throws DidomiNotReadyException
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.
key - string used as a key to find a dictionary/map that contains translation texts.DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public java.lang.String getTranslatedText(java.lang.String key)
throws DidomiNotReadyException
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.
key - string used as a key to find a translated string.DidomiNotReadyException - exception thrown if this method is called before the Didomi SDK is ready.public void setUserAgent(java.lang.String name,
java.lang.String version)
name - version - public void setUser(java.lang.String organizationUserId)
organizationUserId - Organization user IDpublic void setUser(java.lang.String organizationUserId,
@NonNull
java.lang.String organizationUserIdAuthAlgorithm,
@NonNull
java.lang.String organizationUserIdAuthSid,
@Nullable
java.lang.String organizationUserIdAuthSalt,
@NonNull
java.lang.String organizationUserIdAuthDigest)
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 secretpublic boolean hasAnyStatus()