Go to console

FirebaseInAppMessaging

public class FirebaseInAppMessaging extends Object

The entry point of the Firebase In App Messaging headless SDK.

Firebase In-App Messaging will automatically initialize, and start listening for events.

This feature uses a Firebase Instance ID token to:

  • identify the app instance
  • fetch messages from the Firebase backend
  • send usage metrics to the Firebase backend.
To delete the Instance ID and the data associated with it, see deleteInstanceId().

Public Method Summary

void
addClickListener(FirebaseInAppMessagingClickListener clickListener)
Registers a click listener with FIAM, which will be notified on every FIAM click
void
addClickListener(FirebaseInAppMessagingClickListener clickListener, Executor executor)
Registers a click listener with FIAM, which will be notified on every FIAM click, and triggered on the provided executor
void
addDisplayErrorListener(FirebaseInAppMessagingDisplayErrorListener displayErrorListener)
Registers a display error listener with FIAM, which will be notified on every FIAM display error
void
addDisplayErrorListener(FirebaseInAppMessagingDisplayErrorListener displayErrorListener, Executor executor)
Registers a display error listener with FIAM, which will be notified on every FIAM display error, and triggered on the provided executor
void
addImpressionListener(FirebaseInAppMessagingImpressionListener impressionListener)
Registers an impression listener with FIAM, which will be notified on every FIAM impression
void
addImpressionListener(FirebaseInAppMessagingImpressionListener impressionListener, Executor executor)
Registers an impression listener with FIAM, which will be notified on every FIAM impression, and triggered on the provided executor
boolean
areMessagesSuppressed()
Determine whether messages are suppressed or not.
static FirebaseInAppMessaging
getInstance()
Get FirebaseInAppMessaging instance using the firebase app returned by getInstance()
boolean
isAutomaticDataCollectionEnabled()
Determine whether automatic data collection is enabled or not
void
removeClickListener(FirebaseInAppMessagingClickListener clickListener)
Unregisters a click listener
void
removeDisplayErrorListener(FirebaseInAppMessagingDisplayErrorListener displayErrorListener)
Unregisters a display error listener
void
removeImpressionListener(FirebaseInAppMessagingImpressionListener impressionListener)
Unregisters an impression listener
void
setAutomaticDataCollectionEnabled(boolean isAutomaticCollectionEnabled)
Enable or disable automatic data collection for Firebase In-App Messaging.
void
void
setMessagesSuppressed(Boolean areMessagesSuppressed)
Enable or disable suppression of Firebase In App Messaging messages

When enabled, no in app messages will be rendered until either you either disable suppression, or the app restarts, as this state is not preserved over app restarts.

Inherited Method Summary

Public Methods

public void addClickListener (FirebaseInAppMessagingClickListener clickListener)

Registers a click listener with FIAM, which will be notified on every FIAM click

public void addClickListener (FirebaseInAppMessagingClickListener clickListener, Executor executor)

Registers a click listener with FIAM, which will be notified on every FIAM click, and triggered on the provided executor

public void addDisplayErrorListener (FirebaseInAppMessagingDisplayErrorListener displayErrorListener)

Registers a display error listener with FIAM, which will be notified on every FIAM display error

public void addDisplayErrorListener (FirebaseInAppMessagingDisplayErrorListener displayErrorListener, Executor executor)

Registers a display error listener with FIAM, which will be notified on every FIAM display error, and triggered on the provided executor

public void addImpressionListener (FirebaseInAppMessagingImpressionListener impressionListener)

Registers an impression listener with FIAM, which will be notified on every FIAM impression

public void addImpressionListener (FirebaseInAppMessagingImpressionListener impressionListener, Executor executor)

Registers an impression listener with FIAM, which will be notified on every FIAM impression, and triggered on the provided executor

public boolean areMessagesSuppressed ()

Determine whether messages are suppressed or not. This is honored by the UI sdk, which handles rendering the in app message.

Returns
  • true if messages should be suppressed

public static FirebaseInAppMessaging getInstance ()

Get FirebaseInAppMessaging instance using the firebase app returned by getInstance()

public boolean isAutomaticDataCollectionEnabled ()

Determine whether automatic data collection is enabled or not

Returns
  • true if auto initialization is required

public void removeClickListener (FirebaseInAppMessagingClickListener clickListener)

Unregisters a click listener