public class

Trigger

extends Object
implements Parcelable
java.lang.Object
   ↳ com.urbanairship.automation.Trigger

Class Overview

Trigger defines a condition to execute an ScheduleInfo. Use Triggers to build triggers.

Summary

Nested Classes
@interface Trigger.TriggerType  
Constants
int ACTIVE_SESSION Trigger type for active app sessions.
int CUSTOM_EVENT_COUNT Trigger type for custom events.
int CUSTOM_EVENT_VALUE Trigger type for custom events.
int LIFE_CYCLE_APP_INIT Trigger type for app initialization events.
int LIFE_CYCLE_BACKGROUND Trigger type for background events.
int LIFE_CYCLE_FOREGROUND Trigger type for foreground events.
int REGION_ENTER Trigger type for region enter events.
int REGION_EXIT Trigger type for region exit events.
int SCREEN_VIEW Trigger type for screen view events.
int VERSION Trigger type for version.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<Trigger> CREATOR
Public Constructors
Trigger(int type, double goal, JsonPredicate predicate)
Trigger(Parcel in)
Public Methods
int describeContents()
double getGoal()
Returns the trigger's goal.
JsonPredicate getPredicate()
The trigger's predicate.
int getType()
Returns the trigger type.
static Trigger parseJson(JsonValue value)
Parses a Trigger from a JsonValue.
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int ACTIVE_SESSION

Trigger type for active app sessions. Active app session triggers can be created with newActiveSessionTriggerBuilder().

Constant Value: 9 (0x00000009)

public static final int CUSTOM_EVENT_COUNT

Trigger type for custom events. The count of events will be applied to the triggers goal. Custom event triggers can be created with newCustomEventTriggerBuilder().

Constant Value: 5 (0x00000005)

public static final int CUSTOM_EVENT_VALUE

Trigger type for custom events. The event's value will be applied to the triggers goal. Custom event triggers can be created with newCustomEventTriggerBuilder().

Constant Value: 6 (0x00000006)

public static final int LIFE_CYCLE_APP_INIT

Trigger type for app initialization events. App initialization events can be created with newAppInitTriggerBuilder().

Constant Value: 8 (0x00000008)

public static final int LIFE_CYCLE_BACKGROUND

Trigger type for background events. Background triggers can be created with newBackgroundTriggerBuilder()

Constant Value: 2 (0x00000002)

public static final int LIFE_CYCLE_FOREGROUND

Trigger type for foreground events. Foreground triggers can be created with newForegroundTriggerBuilder()

Constant Value: 1 (0x00000001)

public static final int REGION_ENTER

Trigger type for region enter events. Region enter triggers can be created with newEnterRegionTriggerBuilder().

Constant Value: 3 (0x00000003)

public static final int REGION_EXIT

Trigger type for region exit events. Region exit triggers can be created with newExitRegionTriggerBuilder().

Constant Value: 4 (0x00000004)

public static final int SCREEN_VIEW

Trigger type for screen view events. Screen events can be created with newScreenTriggerBuilder().

Constant Value: 7 (0x00000007)

public static final int VERSION

Trigger type for version. Version triggers can be create with newVersionTriggerBuilder(com.urbanairship.json.ValueMatcher)

Constant Value: 10 (0x0000000a)

Fields

public static final Creator<Trigger> CREATOR

Public Constructors

public Trigger (int type, double goal, JsonPredicate predicate)

public Trigger (Parcel in)

Public Methods

public int describeContents ()

public double getGoal ()

Returns the trigger's goal. Once a trigger's goal is hit, it will cause the schedule's actions to perform, then the trigger will be reset.

Returns
  • The trigger's goal.

public JsonPredicate getPredicate ()

The trigger's predicate. The predicate is applied to the event defined by the trigger's type. If the predicate matches the event, then the event's value will be applied to the trigger's goal.

Returns
  • The trigger's predicate.

public int getType ()

Returns the trigger type.

Returns
  • The trigger type.

public static Trigger parseJson (JsonValue value)

Parses a Trigger from a JsonValue.

The expected JsonValue is a map containing:

 - "goal": Required. The trigger's goal. Either the count of event occurrences or the aggregate value of custom event values ("custom_event_value").
 - "predicate": Optional. Json predicate as defined by JsonPredicate scheme.
 - "type": Required. The trigger type.
 

Parameters
value The trigger JSON.
Returns
  • The parsed Trigger.
Throws
JsonException If the JsonValue does not produce a valid Trigger.

public void writeToParcel (Parcel dest, int flags)