public class

InAppActivityMonitor

extends Object
implements ActivityMonitor
java.lang.Object
   ↳ com.urbanairship.iam.InAppActivityMonitor

Class Overview

Activity monitor that filters out any activities with EXCLUDE_FROM_AUTO_SHOW metadata.

Summary

Constants
String EXCLUDE_FROM_AUTO_SHOW Metadata an app can use to prevent an in-app message from showing on a specific activity.
Public Methods
void addActivityListener(ActivityListener listener)
Adds an activity listener.
void addApplicationListener(ApplicationListener listener)
Adds an application listener.
List<Activity> getResumedActivities()
Gets the list of current resumed activities.
List<Activity> getResumedActivities(Predicate<Activity> filter)
Gets the list of current resumed activities that match the filter.
boolean isAppForegrounded()
Determines if the application is in the foreground.
void removeActivityListener(ActivityListener listener)
Removes an activity listener.
void removeApplicationListener(ApplicationListener listener)
Removes an application listener.
static InAppActivityMonitor shared(Context context)
Gets the shared in-app activity monitor instance.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.app.ActivityMonitor

Constants

public static final String EXCLUDE_FROM_AUTO_SHOW

Metadata an app can use to prevent an in-app message from showing on a specific activity.

Constant Value: "com.urbanairship.push.iam.EXCLUDE_FROM_AUTO_SHOW"

Public Methods

public void addActivityListener (ActivityListener listener)

Adds an activity listener.

Parameters
listener The added listener.

public void addApplicationListener (ApplicationListener listener)

Adds an application listener.

Parameters
listener The added listener.

public List<Activity> getResumedActivities ()

Gets the list of current resumed activities.

Returns
  • The resumed activities.

public List<Activity> getResumedActivities (Predicate<Activity> filter)

Gets the list of current resumed activities that match the filter.

Parameters
filter A predicate to filter out activities from the result.
Returns
  • The filtered resumed activities.

public boolean isAppForegrounded ()

Determines if the application is in the foreground.

Returns
  • true if the application is in the foreground, otherwise false.

public void removeActivityListener (ActivityListener listener)

Removes an activity listener.

Parameters
listener The removed listener.

public void removeApplicationListener (ApplicationListener listener)

Removes an application listener.

Parameters
listener The removed listener.

public static InAppActivityMonitor shared (Context context)

Gets the shared in-app activity monitor instance.

Parameters
context The application context.
Returns
  • The shared in-app activity monitor instance.