public class

ActivityMonitor

extends Object
java.lang.Object
   ↳ com.urbanairship.ActivityMonitor

Class Overview

Global activity monitor.

Summary

Nested Classes
interface ActivityMonitor.Listener Listener class for activity updates. 
class ActivityMonitor.SimpleListener A convenience class to extend when you only want to listen for a subset of of activity events. 
Fields
protected Application.ActivityLifecycleCallbacks activityLifecycleCallbacks
Public Constructors
ActivityMonitor()
Public Methods
void addListener(ActivityMonitor.Listener listener)
Adds a listener to the activity monitor.
Activity getResumedActivity()
Gets the current resumed activity.
boolean isAppForegrounded()
Determines if the application is in the foreground.
void removeListener(ActivityMonitor.Listener listener)
Removes a listener from the activity monitor.
static ActivityMonitor shared(Context context)
Creates and retrieves the shared activity monitor instance.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected Application.ActivityLifecycleCallbacks activityLifecycleCallbacks

Public Constructors

public ActivityMonitor ()

Public Methods

public void addListener (ActivityMonitor.Listener listener)

Adds a listener to the activity monitor.

Parameters
listener The added listener.

public Activity getResumedActivity ()

Gets the current resumed activity.

Returns
  • The resumed activity.

public boolean isAppForegrounded ()

Determines if the application is in the foreground.

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

public void removeListener (ActivityMonitor.Listener listener)

Removes a listener from the activity monitor.

Parameters
listener The removed listener.

public static ActivityMonitor shared (Context context)

Creates and retrieves the shared activity monitor instance.

Parameters
context The application context.
Returns
  • The singleton.