UserMessagingPlatform

public final class UserMessagingPlatform extends Object

Entry point for the User Messaging Platform SDK.

Nested Class Summary

interface UserMessagingPlatform.OnConsentFormLoadFailureListener Interface definition for a callback to be invoked when a consent form failed to load. 
interface UserMessagingPlatform.OnConsentFormLoadSuccessListener Interface definition for a callback to be invoked when a consent form loads successfully. 

Public Method Summary

static ConsentInformation
getConsentInformation(Context context)
static void
loadAndShowConsentFormIfRequired(Activity activity, ConsentForm.OnConsentFormDismissedListener onConsentFormDismissedListener)
Loads a consent form and immediately shows it from the provided Activity if ConsentInformation.getConsentStatus() is ConsentInformation.ConsentStatus.REQUIRED.
static void
static void
showPrivacyOptionsForm(Activity activity, ConsentForm.OnConsentFormDismissedListener onConsentFormDismissedListener)

Inherited Method Summary

Public Methods

public static ConsentInformation getConsentInformation (Context context)

Parameters
context

public static void loadAndShowConsentFormIfRequired (Activity activity, ConsentForm.OnConsentFormDismissedListener onConsentFormDismissedListener)

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

Calls ConsentForm.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 The activity showing the consent form.
onConsentFormDismissedListener The listener that gets called when the consent form is dismissed.

public static void loadConsentForm (Context context, UserMessagingPlatform.OnConsentFormLoadSuccessListener successListener, UserMessagingPlatform.OnConsentFormLoadFailureListener failureListener)

Loads a ConsentForm.

Checks that ConsentInformation.isConsentFormAvailable() returns true prior to calling this method.

This method must be called on the main thread.

Parameters
context The context.
successListener The consent form load success listener.
failureListener The consent form load failure listener.

public static void showPrivacyOptionsForm (Activity activity, ConsentForm.OnConsentFormDismissedListener onConsentFormDismissedListener)

Presents a privacy options form from the provided Activity if ConsentInformation.getPrivacyOptionsRequirementStatus() is ConsentInformation.PrivacyOptionsRequirementStatus.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.

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

ConsentForm.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 The activity showing the privacy options form.
onConsentFormDismissedListener The listener that gets called when the privacy options form is dismissed.