Class Didomi
- java.lang.Object
-
- io.didomi.sdk.Didomi
-
public class Didomi extends java.lang.ObjectMain class exposed to apps
-
-
Field Summary
Fields Modifier and Type Field Description protected io.didomi.sdk.apiEvents.ApiEventsRepositoryapiEventsRepositoryprotected ConfigurationRepositoryconfigurationRepositoryprotected io.didomi.sdk.remote.ConnectivityHelperconnectivityHelperprotected io.didomi.sdk.consent.ConsentRepositoryconsentRepositoryprotected io.didomi.sdk.ContextHelpercontextHelperprotected io.didomi.sdk.location.CountryHelpercountryHelperprotected io.didomi.sdk.DidomiInitializeParametersdidomiInitializeParametersprotected HttpRequestHelperhttpRequestHelperprotected LanguageReceiverlanguageReceiverprotected io.didomi.sdk.resources.LanguagesHelperlanguagesHelperprotected io.didomi.sdk.remote.RemoteFilesHelperremoteFilesHelperprotected io.didomi.sdk.resources.ResourcesHelperresourcesHelperprotected android.content.SharedPreferencessharedPreferencesprotected io.didomi.sdk.user.sync.SyncRepositorysyncRepositoryprotected io.didomi.sdk.tcf.TCFRepositorytcfRepositoryprotected io.didomi.sdk.ui.UIProvideruiProviderprotected io.didomi.sdk.ui.UIStateRepositoryuiStateRepositoryprotected io.didomi.sdk.utils.UserChoicesInfoProvideruserChoicesInfoProviderprotected io.didomi.sdk.user.UserRepositoryuserRepositoryprotected io.didomi.sdk.UserStatusRepositoryuserStatusRepositoryprotected VendorRepositoryvendorRepositorystatic java.lang.StringVIEW_PURPOSESstatic java.lang.StringVIEW_VENDORS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddEventListener(io.didomi.sdk.events.EventListener listener)Add an event listenervoidaddEventListener(io.didomi.sdk.functionalinterfaces.DidomiEventListener listener)Add an event listenerstatic voidclearInstance()Internal use only. Clear the Didomi instance so it is possible to initialize it again.voidforceShowNotice(androidx.fragment.app.FragmentActivity activity)Force show the consent notice without checking if consent is requiredio.didomi.sdk.apiEvents.ApiEventsRepositorygetApiEventsRepository()Getter method for apiEventsRepository property.ConfigurationRepositorygetConfigurationRepository()Getter for configurationRepository property.io.didomi.sdk.consent.ConsentRepositorygetConsentRepository()Getter method for consentRepository property.io.didomi.sdk.ContextHelpergetContextHelper()Getter method for context helper.io.didomi.sdk.location.CountryHelpergetCountryHelper()Getter method for countryHelper property.io.didomi.sdk.DeviceTypegetDeviceType()Get the device type determined by Didomi SDKjava.util.Set<java.lang.String>getDisabledPurposeIds()Deprecated.usegetUserStatus()instead.java.util.Set<Purpose>getDisabledPurposes()Deprecated.usegetUserStatus()instead.java.util.Set<java.lang.String>getDisabledVendorIds()Deprecated.usegetUserStatus()instead.java.util.Set<Vendor>getDisabledVendors()Deprecated.usegetUserStatus()instead.java.util.Set<java.lang.String>getEnabledPurposeIds()Deprecated.usegetUserStatus()instead.java.util.Set<Purpose>getEnabledPurposes()Deprecated.usegetUserStatus()instead.java.util.Set<java.lang.String>getEnabledVendorIds()Deprecated.usegetUserStatus()instead.java.util.Set<Vendor>getEnabledVendors()Deprecated.usegetUserStatus()instead.io.didomi.sdk.events.EventsRepositorygetEventsRepository()Getter method for eventsRepository.static DidomigetInstance()Get the global singleton instance of the Didomi SDK.java.lang.StringgetJavaScriptForWebView()Get JavaScript to embed into a WebView to pass the consent status from the app to the Didomi Web SDK embedded into the WebViewjava.lang.StringgetJavaScriptForWebView(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 WebViewio.didomi.sdk.resources.LanguagesHelpergetLanguagesHelper()Method used to get the language helper.intgetLogoResourceId()Get the logo resource idio.didomi.sdk.user.OrganizationUserRepositorygetOrganizationUserRepository()Getter method for organizationUserRepositoryPurposegetPurpose(java.lang.String purposeId)Get a purpose from its IDjava.lang.StringgetQueryStringForWebView()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 IDsjava.util.Set<Purpose>getRequiredPurposes()Get the configured purposesjava.util.Set<java.lang.String>getRequiredVendorIds()Get the configured vendor IDsjava.util.Set<Vendor>getRequiredVendors()Get the configured vendorsio.didomi.sdk.resources.ResourcesHelpergetResourcesHelper()Retrieve ResourcesHelper used to handle device resourcesjava.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.StringgetTranslatedText(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.UIStateRepositorygetUiStateRepository()Internal use only. Used to handle some UI state parameters.java.lang.BooleangetUserConsentStatusForPurpose(java.lang.String purposeId)Deprecated.usegetUserStatus()instead.java.lang.BooleangetUserConsentStatusForVendor(java.lang.String vendorId)Deprecated.usegetUserStatus()instead.java.lang.BooleangetUserConsentStatusForVendorAndRequiredPurposes(java.lang.String vendorId)Deprecated.usegetUserStatus()instead.java.lang.BooleangetUserLegitimateInterestStatusForPurpose(java.lang.String purposeId)Deprecated.usegetUserStatus()instead.java.lang.BooleangetUserLegitimateInterestStatusForVendor(java.lang.String vendorId)Deprecated.usegetUserStatus()instead.booleangetUserLegitimateInterestStatusForVendorAndRequiredPurposes(java.lang.String vendorId)Deprecated.usegetUserStatus()instead.io.didomi.sdk.user.UserRepositorygetUserRepository()Getter for UserRepository property.io.didomi.sdk.models.UserStatusgetUserStatus()Get the user consent statusbooleangetUserStatusForVendor(java.lang.String vendorId)Deprecated.usegetUserStatus()instead.VendorgetVendor(java.lang.String vendorId)Get a vendor from its IDbooleanhasAnyStatus()Check if we have collected any status (consent or legitimate interest) from the uservoidhideNotice()Hide the notice if it is currently displayedvoidhidePreferences()Hide the Preferences dialogvoidinitialize(android.app.Application application, io.didomi.sdk.DidomiInitializeParameters parameters)Initialize the Didomi SDK and load its configuration.voidinitialize(android.app.Application application, java.lang.String apiKey, java.lang.String localConfigurationPath, java.lang.String remoteConfigurationURL, java.lang.String providerId)Deprecated.voidinitialize(android.app.Application application, java.lang.String apiKey, java.lang.String localConfigurationPath, java.lang.String remoteConfigurationURL, java.lang.String providerId, java.lang.Boolean disableDidomiRemoteConfig)Deprecated.voidinitialize(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)Deprecated.voidinitialize(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)Deprecated.booleanisConsentRequired()Determine if consent is required for the user.booleanisError()Has the Didomi SDK encountered an error ?booleanisInitialized()Is the Didomi SDK initialized? This is set to `true` immediately after the call to `initialize()`.booleanisNoticeVisible()Check if the consent notice is currently displayedbooleanisPreferencesVisible()Check if the Preferences view is currently displayedbooleanisReady()Is the Didomi SDK ready?booleanisUserConsentStatusPartial()Determine if consent information is available for all purposes and vendors that are requiredbooleanisUserLegitimateInterestStatusPartial()Determine if legitimate interest information is available for all purposes and vendors that are requiredbooleanisUserStatusPartial()Check if consent or legitimate interest status is partialvoidonError(DidomiCallable callback)Provide a function that needs to be called if the SDK encounters an error during initialization.voidonReady(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)voidremoveEventListener(io.didomi.sdk.functionalinterfaces.DidomiEventListener listener)Remove a previously added event listenervoidreset()Remove all consents for the uservoidsetLogLevel(int minLevel)Set the minimum level of messages to logvoidsetupUI(androidx.fragment.app.FragmentActivity activity)Show the consent notice if required (ie if consent information is missing)voidsetUser(io.didomi.sdk.user.UserAuthParams userAuthParams)Set user information with authenticationvoidsetUser(java.lang.String organizationUserId)Set user informationvoidsetUser(java.lang.String organizationUserId, java.lang.String organizationUserIdAuthAlgorithm, java.lang.String organizationUserIdAuthSid, java.lang.String organizationUserIdAuthSalt, java.lang.String organizationUserIdAuthDigest)Deprecated.UsesetUser(UserAuthParams)insteadvoidsetUserAgent(java.lang.String name, java.lang.String version)Set custom user agent name and versionbooleansetUserAgreeToAll()Enable all purposes and vendors for the user.booleansetUserConsentStatus(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.booleansetUserConsentStatusFromObjects(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.booleansetUserDisagreeToAll()Update user status to disagree : disable consent and legitimate interest purposes, disable consent vendors, but still enable legitimate interest vendors.booleansetUserStatus(boolean purposesConsentStatus, boolean purposesLIStatus, boolean vendorsConsentStatus, boolean vendorsLIStatus)Set the user status globallybooleansetUserStatus(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 statusbooleansetUserStatus(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)Deprecated.This internal function should not be used, usesetUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)insteadbooleansetUserStatusFromObjects(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)Deprecated.This internal function should not be used, usesetUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)insteadbooleansetUserStatusFromObjects(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)Deprecated.This internal function should not be used, usesetUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)insteadbooleanshouldConsentBeCollected()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 yetvoidshowNotice(androidx.fragment.app.FragmentActivity activity)Show the consent notice (if required, not disabled in the config and not already displayed)voidshowPreferences(androidx.fragment.app.FragmentActivity activity)Show the Preferences dialog on the Purposes viewvoidshowPreferences(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.voidupdateSelectedLanguage(java.lang.String languageCode)Update the selected language of the Didomi SDK and any property that depends on it.
-
-
-
Field Detail
-
VIEW_PURPOSES
public static final java.lang.String VIEW_PURPOSES
- See Also:
- Constant Field Values
-
VIEW_VENDORS
public static final java.lang.String VIEW_VENDORS
- See Also:
- Constant Field Values
-
apiEventsRepository
@Inject protected io.didomi.sdk.apiEvents.ApiEventsRepository apiEventsRepository
-
configurationRepository
@Inject protected ConfigurationRepository configurationRepository
-
connectivityHelper
@Inject protected io.didomi.sdk.remote.ConnectivityHelper connectivityHelper
-
consentRepository
@Inject protected io.didomi.sdk.consent.ConsentRepository consentRepository
-
contextHelper
@Inject protected io.didomi.sdk.ContextHelper contextHelper
-
countryHelper
@Inject protected io.didomi.sdk.location.CountryHelper countryHelper
-
didomiInitializeParameters
@Inject protected io.didomi.sdk.DidomiInitializeParameters didomiInitializeParameters
-
httpRequestHelper
@Inject protected HttpRequestHelper httpRequestHelper
-
languagesHelper
@Inject protected io.didomi.sdk.resources.LanguagesHelper languagesHelper
-
languageReceiver
@Inject protected LanguageReceiver languageReceiver
-
remoteFilesHelper
@Inject protected io.didomi.sdk.remote.RemoteFilesHelper remoteFilesHelper
-
resourcesHelper
@Inject protected io.didomi.sdk.resources.ResourcesHelper resourcesHelper
-
sharedPreferences
@Inject protected android.content.SharedPreferences sharedPreferences
-
syncRepository
@Inject @Nullable protected io.didomi.sdk.user.sync.SyncRepository syncRepository
-
tcfRepository
@Inject protected io.didomi.sdk.tcf.TCFRepository tcfRepository
-
uiStateRepository
@Inject protected io.didomi.sdk.ui.UIStateRepository uiStateRepository
-
uiProvider
@Inject protected io.didomi.sdk.ui.UIProvider uiProvider
-
userChoicesInfoProvider
@Inject protected io.didomi.sdk.utils.UserChoicesInfoProvider userChoicesInfoProvider
-
userStatusRepository
@Inject protected io.didomi.sdk.UserStatusRepository userStatusRepository
-
userRepository
@Inject protected io.didomi.sdk.user.UserRepository userRepository
-
vendorRepository
@Inject protected VendorRepository vendorRepository
-
-
Method Detail
-
getInstance
public static Didomi getInstance()
Get the global singleton instance of the Didomi SDK.- Returns:
- Didomi
-
clearInstance
public static void clearInstance()
Internal use only. Clear the Didomi instance so it is possible to initialize it again.
-
setLogLevel
public void setLogLevel(int minLevel)
Set the minimum level of messages to logMessages 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
- Parameters:
minLevel- Minimum level of messages to log
-
getLogoResourceId
public int getLogoResourceId()
Get the logo resource id- Returns:
- the resource id of the logo defined in application configuration, or 0 if logo was not defined or does not correspond to an image in the project resources
-
getEventsRepository
public io.didomi.sdk.events.EventsRepository getEventsRepository() throws DidomiNotReadyExceptionGetter method for eventsRepository.- Returns:
- instance of EventsRepository.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getOrganizationUserRepository
public io.didomi.sdk.user.OrganizationUserRepository getOrganizationUserRepository()
Getter method for organizationUserRepository- Returns:
- an instance of OrganizationUserRepository
-
initialize
@Deprecated 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.ExceptionDeprecated.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. 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.- Throws:
java.lang.Exception- Since:
- Deprecated since version 1.42.0
-
initialize
@Deprecated 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, java.lang.String noticeId) throws java.lang.ExceptionDeprecated.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. By default 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 language is available 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 targeting- Throws:
java.lang.Exception- Since:
- Deprecated since version 1.42.0
-
initialize
public void initialize(android.app.Application application, io.didomi.sdk.DidomiInitializeParameters parameters) throws java.lang.ExceptionInitialize 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-DidomiInitializeParametersobject specifying parameters to initialize the SDK.- Throws:
java.lang.Exception
-
initialize
@Deprecated 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) throws java.lang.ExceptionDeprecated.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. 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.- Throws:
java.lang.Exception- Since:
- Deprecated since version 1.42.0
-
initialize
@Deprecated 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) throws java.lang.ExceptionDeprecated.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. 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).- Throws:
java.lang.Exception- Since:
- Deprecated since version 1.42.0
-
getLanguagesHelper
public io.didomi.sdk.resources.LanguagesHelper getLanguagesHelper() throws DidomiNotReadyExceptionMethod used to get the language helper.- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getResourcesHelper
public io.didomi.sdk.resources.ResourcesHelper getResourcesHelper() throws DidomiNotReadyExceptionRetrieve ResourcesHelper used to handle device resources- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getUiStateRepository
public io.didomi.sdk.ui.UIStateRepository getUiStateRepository() throws DidomiNotReadyExceptionInternal use only. Used to handle some UI state parameters.- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
isConsentRequired
public boolean isConsentRequired() throws DidomiNotReadyExceptionDetermine if consent is required for the user. The rules are (OR): - The user country is in the EU - The company is from the EU - The user country is unknown and the app has chosen to collect consent when unknown- Returns:
- True if consent is required, false if it is not required.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
isUserConsentStatusPartial
public boolean isUserConsentStatusPartial() throws DidomiNotReadyExceptionDetermine if consent information is available for all purposes and vendors that are required- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
isUserLegitimateInterestStatusPartial
public boolean isUserLegitimateInterestStatusPartial() throws DidomiNotReadyExceptionDetermine if legitimate interest information is available for all purposes and vendors that are required- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
isUserStatusPartial
public boolean isUserStatusPartial() throws DidomiNotReadyExceptionCheck if consent or legitimate interest status is partial- Returns:
- **true** if consent or legitimate interest is partial, **false** otherwise
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getUserStatus
@NonNull public io.didomi.sdk.models.UserStatus getUserStatus() throws DidomiNotReadyExceptionGet the user consent status- Returns:
- the user consent status as
UserStatus - Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getUserConsentStatusForVendor
@Deprecated @Nullable public java.lang.Boolean getUserConsentStatusForVendor(java.lang.String vendorId) throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. Search the vendorId in getUserStatus().getVendors().getGlobalConsent().getEnabled() or getUserStatus().getVendors().getConsent().getDisabled().Get the user consent status for a specific vendor- Parameters:
vendorId-- Returns:
- the user consent status for this vendor
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.43.1
-
getUserLegitimateInterestStatusForVendor
@Deprecated public java.lang.Boolean getUserLegitimateInterestStatusForVendor(java.lang.String vendorId) throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. Search the vendorId in getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or getUserStatus().getVendors().getLegitimateInterest().getDisabled().Get the user legitimate interest status for a specific vendor- Parameters:
vendorId-- Returns:
- the user consent status for this vendor
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.43.1
-
getUserStatusForVendor
@Deprecated public boolean getUserStatusForVendor(java.lang.String vendorId) throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. Search the vendorId in getUserStatus().getVendors().getGlobal().getEnabled() or getUserStatus().getVendors().getGlobal().getDisabled().Get the user consent and legitimate interest status for a specific vendor- Parameters:
vendorId-- Returns:
- true if both consent and legitimate interest status are enabled by the user, false otherwise
- Throws:
DidomiNotReadyException- Since:
- Deprecated since 1.43.1
-
getUserConsentStatusForPurpose
@Deprecated @Nullable public java.lang.Boolean getUserConsentStatusForPurpose(java.lang.String purposeId) throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. Search the purposeId in getUserStatus().getPurposes().getConsent().getEnabled() or getUserStatus().getPurposes().getConsent().getDisabled().Get the user consent status for a specific purpose- Parameters:
purposeId-- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.43.1
-
getUserLegitimateInterestStatusForPurpose
@Deprecated public java.lang.Boolean getUserLegitimateInterestStatusForPurpose(java.lang.String purposeId) throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. Search the purposeId in getUserStatus().getPurposes().getLegitimateInterest().getEnabled() or getUserStatus().getPurposes().getLegitimateInterest().getDisabled().Get the user legitimate interest status for a specific purpose- Parameters:
purposeId-- Returns:
- the user consent status for this purpose
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.43.1
-
getUserConsentStatusForVendorAndRequiredPurposes
@Deprecated public java.lang.Boolean getUserConsentStatusForVendorAndRequiredPurposes(java.lang.String vendorId) throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getVendors().getGlobalConsent().getEnabled() or getUserStatus().getVendors().getGlobalConsent().getDisabled().Check if a vendor has consent for all the purposes that it requires- Parameters:
vendorId-- Returns:
- the user consent status for all the purpose of this vendor
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.43.1
-
getUserLegitimateInterestStatusForVendorAndRequiredPurposes
@Deprecated public boolean getUserLegitimateInterestStatusForVendorAndRequiredPurposes(java.lang.String vendorId) throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. Search the purposeId in getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or getUserStatus().getVendors().getGlobalLegitimateInterest().getDisabled().Check if a vendor has consent for all the legitimate interest purposes that it requires- Parameters:
vendorId-- Returns:
- the user consent status for all the legitimate interest purposes of this vendor
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.43.1
-
setUserAgreeToAll
public boolean setUserAgreeToAll() throws DidomiNotReadyExceptionEnable all purposes and vendors for the user.- Returns:
- true if user consent status was updated, false otherwise.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
setUserDisagreeToAll
public boolean setUserDisagreeToAll() throws DidomiNotReadyExceptionUpdate user status to disagree : disable consent and legitimate interest purposes, disable consent vendors, but still enable legitimate interest vendors.- Returns:
- true if user status was updated, false otherwise.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
setUserStatus
public boolean setUserStatus(boolean purposesConsentStatus, boolean purposesLIStatus, boolean vendorsConsentStatus, boolean vendorsLIStatus) throws DidomiNotReadyExceptionSet 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- Returns:
- true if user consent status was updated, false otherwise.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
setUserConsentStatus
@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 DidomiNotReadyExceptionDeprecated.- Throws:
DidomiNotReadyException- Since:
- Deprecated since version 1.31.0
- See Also:
setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)
-
setUserStatus
@Deprecated 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 DidomiNotReadyExceptionDeprecated.This internal function should not be used, usesetUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)instead- Throws:
DidomiNotReadyException- Since:
- Deprecated since version 1.45.0
- See Also:
setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)
-
setUserStatus
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 DidomiNotReadyExceptionSet the user status- 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- Returns:
- true if user consent status was updated, false otherwise.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
setUserConsentStatusFromObjects
@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
Deprecated.- Throws:
DidomiNotReadyException- Since:
- Deprecated since version 1.31.0
- See Also:
setUserStatusFromObjects(Set, Set, Set, Set, Set, Set, Set, Set)
-
setUserStatusFromObjects
@Deprecated 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) throws DidomiNotReadyException
Deprecated.This internal function should not be used, usesetUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)instead- Throws:
DidomiNotReadyException- Since:
- Deprecated since version 1.45.0
- See Also:
setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)
-
setUserStatusFromObjects
@Deprecated 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
Deprecated.This internal function should not be used, usesetUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)instead- Throws:
DidomiNotReadyException- Since:
- Deprecated since version 1.45.0
- See Also:
setUserStatus(Set, Set, Set, Set, Set, Set, Set, Set)
-
getConfigurationRepository
public ConfigurationRepository getConfigurationRepository() throws DidomiNotReadyException
Getter for configurationRepository property.- Returns:
- an instance of ConfigurationRepository.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getConsentRepository
public io.didomi.sdk.consent.ConsentRepository getConsentRepository() throws DidomiNotReadyExceptionGetter method for consentRepository property.- Returns:
- instance of ConsentRepository.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getCountryHelper
public io.didomi.sdk.location.CountryHelper getCountryHelper() throws DidomiNotReadyExceptionGetter method for countryHelper property.- Returns:
- an instance of CountryHelper.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getContextHelper
public io.didomi.sdk.ContextHelper getContextHelper() throws DidomiNotReadyExceptionGetter method for context helper.- Returns:
- an instance of ContextHelper.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getApiEventsRepository
public io.didomi.sdk.apiEvents.ApiEventsRepository getApiEventsRepository() throws DidomiNotReadyExceptionGetter method for apiEventsRepository property.- Returns:
- instance of ApiEventsRepository.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getUserRepository
public io.didomi.sdk.user.UserRepository getUserRepository() throws DidomiNotReadyExceptionGetter for UserRepository property.- Returns:
- an instance of UserRepository.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
addEventListener
public void addEventListener(io.didomi.sdk.events.EventListener listener)
Add an event listener- Parameters:
listener- the EventListener to add
-
addEventListener
public void addEventListener(io.didomi.sdk.functionalinterfaces.DidomiEventListener listener)
Add an event listener- Parameters:
listener- the DidomiEventListener to add
-
removeEventListener
public void removeEventListener(io.didomi.sdk.functionalinterfaces.DidomiEventListener listener)
Remove a previously added event listener- Parameters:
listener- the DidomiEventListener to remove
-
setupUI
public void setupUI(androidx.fragment.app.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
public void forceShowNotice(androidx.fragment.app.FragmentActivity activity) throws DidomiNotReadyExceptionForce show the consent notice without checking if consent is required- Parameters:
activity- base activity to use for notice- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
showNotice
public void showNotice(androidx.fragment.app.FragmentActivity activity) throws DidomiNotReadyExceptionShow the consent notice (if required, not disabled in the config and not already displayed)- Parameters:
activity- base activity to use for notice- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
hideNotice
public void hideNotice() throws DidomiNotReadyExceptionHide the notice if it is currently displayed- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
isNoticeVisible
public boolean isNoticeVisible() throws DidomiNotReadyExceptionCheck if the consent notice is currently displayed- Returns:
- true if ConsentNoticeBottomFragment or ConsentNoticePopupFragment exists
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
shouldConsentBeCollected
public boolean shouldConsentBeCollected() throws DidomiNotReadyExceptionCheck 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- Returns:
- true if consent should be collected
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
showPreferences
public void showPreferences(androidx.fragment.app.FragmentActivity activity) throws DidomiNotReadyExceptionShow the Preferences dialog on the Purposes view- Parameters:
activity- activity used to get the support fragment manager.- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
showPreferences
public void showPreferences(androidx.fragment.app.FragmentActivity activity, java.lang.String view) throws DidomiNotReadyExceptionMethod 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).- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
hidePreferences
public void hidePreferences() throws DidomiNotReadyExceptionHide the Preferences dialog- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
isPreferencesVisible
public boolean isPreferencesVisible() throws DidomiNotReadyExceptionCheck if the Preferences view is currently displayed- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
isReady
public boolean isReady()
Is the Didomi SDK ready?- Returns:
- true if sdk is ready
-
isError
public boolean isError()
Has the Didomi SDK encountered an error ?- Returns:
- true if sdk has error
-
isInitialized
public boolean isInitialized()
Is the Didomi SDK initialized? This is set to `true` immediately after the call to `initialize()`. The SDK might not be ready yet so use `isReady()` or `onReady()` instead of this function.- Returns:
- true if sdk is initialized
-
onReady
public void onReady(DidomiCallable callback) throws java.lang.Exception
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.- Throws:
java.lang.Exception
-
onError
public void onError(DidomiCallable callback) throws java.lang.Exception
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- Throws:
java.lang.Exception
-
reset
public void reset() throws DidomiNotReadyExceptionRemove all consents for the user- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getRequiredPurposeIds
public java.util.Set<java.lang.String> getRequiredPurposeIds() throws DidomiNotReadyExceptionGet the configured purpose IDs- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getRequiredVendorIds
public java.util.Set<java.lang.String> getRequiredVendorIds() throws DidomiNotReadyExceptionGet the configured vendor IDs- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getRequiredPurposes
public java.util.Set<Purpose> getRequiredPurposes() throws DidomiNotReadyException
Get the configured purposes- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getRequiredVendors
public java.util.Set<Vendor> getRequiredVendors() throws DidomiNotReadyException
Get the configured vendors- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getEnabledPurposes
@Deprecated public java.util.Set<Purpose> getEnabledPurposes() throws DidomiNotReadyException
Deprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getPurposes().getGlobal().getEnabled().Get the enabled purposes- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getEnabledPurposeIds
@Deprecated public java.util.Set<java.lang.String> getEnabledPurposeIds() throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getPurposes().getGlobal().getEnabled().Get the IDs of the enabled purposes- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getDisabledPurposes
@Deprecated public java.util.Set<Purpose> getDisabledPurposes() throws DidomiNotReadyException
Deprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getPurposes().getConsent().getDisabled().Get the disabled purposes- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getDisabledPurposeIds
@Deprecated public java.util.Set<java.lang.String> getDisabledPurposeIds() throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getPurposes().getConsent().getDisabled().Get the IDs of the disabled purposes- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getEnabledVendors
@Deprecated public java.util.Set<Vendor> getEnabledVendors() throws DidomiNotReadyException
Deprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getEnabled().Get the enabled vendors- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getEnabledVendorIds
@Deprecated public java.util.Set<java.lang.String> getEnabledVendorIds() throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getEnabled().Get the IDs of the enabled vendors- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getDisabledVendors
@Deprecated public java.util.Set<Vendor> getDisabledVendors() throws DidomiNotReadyException
Deprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getDisabled().Get the disabled vendors- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getDisabledVendorIds
@Deprecated public java.util.Set<java.lang.String> getDisabledVendorIds() throws DidomiNotReadyExceptionDeprecated.usegetUserStatus()instead. The result of this method has been replaced by getUserStatus().getVendors().getConsent().getDisabled().Get the IDs of the disabled vendors- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.- Since:
- Deprecated since 1.42.0
-
getPurpose
public Purpose getPurpose(java.lang.String purposeId) throws DidomiNotReadyException
Get a purpose from its ID- Parameters:
purposeId-- Returns:
- the
Purposematching the id - Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getVendor
public Vendor getVendor(java.lang.String vendorId) throws DidomiNotReadyException
Get a vendor from its ID- Parameters:
vendorId-- Returns:
- the
Vendormatching the id - Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getJavaScriptForWebView
public java.lang.String getJavaScriptForWebView(java.lang.String extra) throws DidomiNotReadyExceptionGet 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`.
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- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getQueryStringForWebView
public java.lang.String getQueryStringForWebView() throws DidomiNotReadyExceptionGet 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.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.
- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getJavaScriptForWebView
public java.lang.String getJavaScriptForWebView() throws DidomiNotReadyExceptionGet 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`
- Returns:
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getDeviceType
public io.didomi.sdk.DeviceType getDeviceType() throws DidomiNotReadyExceptionGet the device type determined by Didomi SDK- Returns:
- the device for which Didomi will display UI
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
updateSelectedLanguage
public void updateSelectedLanguage(java.lang.String languageCode) throws DidomiNotReadyExceptionUpdate 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.- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getText
public java.util.Map<java.lang.String,java.lang.String> getText(java.lang.String key) throws DidomiNotReadyExceptionMethod 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.- Returns:
- a dictionary/map that contains the translation texts in different languages for the given key.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
getTranslatedText
public java.lang.String getTranslatedText(java.lang.String key) throws DidomiNotReadyExceptionMethod 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.- Returns:
- a translated string based on the provided key and the selected language.
- Throws:
DidomiNotReadyException- exception thrown if this method is called before the Didomi SDK is ready.
-
setUserAgent
public void setUserAgent(@NonNull java.lang.String name, @NonNull java.lang.String version)Set custom user agent name and version- Parameters:
name-version-
-
setUser
public void setUser(java.lang.String organizationUserId)
Set user information- Parameters:
organizationUserId- Organization user ID
-
setUser
@Deprecated public 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)Deprecated.UsesetUser(UserAuthParams)insteadSet 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- Since:
- Deprecated since version 1.43.0
-
setUser
public void setUser(@NonNull io.didomi.sdk.user.UserAuthParams userAuthParams)Set user information with authentication- Parameters:
userAuthParams- User authentication parameters
-
hasAnyStatus
public boolean hasAnyStatus()
Check if we have collected any status (consent or legitimate interest) from the user- Returns:
- True if the user has at least one status, positive of negative
-
-