public class

GlobalActivityMonitor

extends Object
implements ActivityMonitor
java.lang.Object
   ↳ com.urbanairship.app.GlobalActivityMonitor

Class Overview

Global activity monitor.

Summary

Public Constructors
GlobalActivityMonitor()
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 GlobalActivityMonitor shared(Context context)
Creates and retrieves the shared activity monitor instance.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.app.ActivityMonitor

Public Constructors

public GlobalActivityMonitor ()

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 GlobalActivityMonitor shared (Context context)

Creates and retrieves the shared activity monitor instance.

Parameters
context The application context.
Returns
  • The singleton.