UserMessagingPlatform

class UserMessagingPlatform


Entry point for the User Messaging Platform SDK.

Summary

Nested types

Interface definition for a callback to be invoked when a consent form failed to load.

Interface definition for a callback to be invoked when a consent form loads successfully.

Public functions

java-static ConsentInformation!

Gets the ConsentInformation.

java-static Unit
loadAndShowConsentFormIfRequired(
    activity: Activity!,
    onConsentFormDismissedListener: ConsentForm.OnConsentFormDismissedListener!
)

Loads a consent form and immediately shows it from the provided Activity if getConsentStatus is REQUIRED.

java-static Unit

Loads a ConsentForm.

java-static Unit
showPrivacyOptionsForm(
    activity: Activity!,
    onConsentFormDismissedListener: ConsentForm.OnConsentFormDismissedListener!
)

Presents a privacy options form from the provided Activity if getPrivacyOptionsRequirementStatus is REQUIRED.

Public functions

getConsentInformation

java-static fun getConsentInformation(context: Context!): ConsentInformation!

Gets the ConsentInformation.

loadAndShowConsentFormIfRequired

java-static fun loadAndShowConsentFormIfRequired(
    activity: Activity!,
    onConsentFormDismissedListener: ConsentForm.OnConsentFormDismissedListener!
): Unit

Loads a consent form and immediately shows it from the provided Activity if getConsentStatus is REQUIRED.

Calls OnConsentFormDismissedListener when this method finishes, which may occur due to one of the following:

  • the user is presented with the form, selects an option, and dismisses the form
  • the form is not required to show
  • the form fails to load, returning a non-null FormError
  • the form fails to show, returning a non-null FormError

This method must be called on the main thread.

Parameters
activity: Activity!

The activity showing the consent form.

onConsentFormDismissedListener: ConsentForm.OnConsentFormDismissedListener!

The listener that gets called when the consent form is dismissed.

loadConsentForm

java-static fun loadConsentForm(
    context: Context!,
    successListener: UserMessagingPlatform.OnConsentFormLoadSuccessListener!,
    failureListener: UserMessagingPlatform.OnConsentFormLoadFailureListener!
): Unit

Loads a ConsentForm.

Checks that isConsentFormAvailable returns true prior to calling this method.

This method must be called on the main thread.

Parameters
context: Context!

The context.

successListener: UserMessagingPlatform.OnConsentFormLoadSuccessListener!

The consent form load success listener.

failureListener: UserMessagingPlatform.OnConsentFormLoadFailureListener!

The consent form load failure listener.

showPrivacyOptionsForm

java-static fun showPrivacyOptionsForm(
    activity: Activity!,
    onConsentFormDismissedListener: ConsentForm.OnConsentFormDismissedListener!
): Unit

Presents a privacy options form from the provided Activity if getPrivacyOptionsRequirementStatus is REQUIRED.

This method should only be called in response to a user input to request a privacy options form to be shown.

The privacy options form is preloaded by the SDK automatically when a form becomes available. If no form has been preloaded, the SDK will try to load one asynchronously.

OnConsentFormDismissedListener is called after the user is presented with a form, selects an option, and dismisses the form.

OnConsentFormDismissedListener may also return asynchronously on the next run loop with a non-null FormError under one of the following error conditions:

  • the form is not available
  • the form fails to show
  • the form is still being preloaded

This method must be called on the main thread.

Parameters
activity: Activity!

The activity showing the privacy options form.

onConsentFormDismissedListener: ConsentForm.OnConsentFormDismissedListener!

The listener that gets called when the privacy options form is dismissed.