FenceState

public abstract classFenceStateextendsObject
implementsParcelable

Encapsulates the state of a fence inAwarenessFence. The state includes the current and previous evaluation state and time of the last fence state update.

Constant Summary

int FALSE Fence state is false.
int TRUE Fence state is true.
int UNKNOWN Fence state is unknown, which can be due to no data received.

Inherited Constant Summary

Public Constructor Summary

Public Method Summary

staticFenceState
extract(Intent intent)
Extracts the fence state details from the intent.
abstract int
getCurrentState()
Returns the current fence state.
abstractString
getFenceKey()
Returns the fence key that identifies this fence in AwarenessFence.
abstract long
getLastFenceUpdateTimeMillis()
Returns the last time the fence state was changed in milliseconds since epoch.
abstract int
getPreviousState()
Returns the previous fence state.

Inherited Method Summary

Constants

public static final int FALSE

Fence state is false.

Constant Value:1

public static final int TRUE

Fence state is true.

Constant Value:2

public static final int UNKNOWN

Fence state is unknown, which can be due to no data received.

Constant Value:0

Public Constructors

publicFenceState()

Public Methods

public staticFenceState extract(Intent intent)

Extracts the fence state details from the intent.

Parameters
intent TheIntent object received from registering a fence.
Returns
  • Information about the fence state.

public abstract intgetCurrentState()

Returns the current fence state.

Returns
  • The state of the fence inAwarenessFence.
    • TRUE indicates that the state of fence evaluation is true.
    • FALSEindicates that the state of fence evaluation is false.
    • UNKNOWNindicates an unknown fence evaluation state. This may be due to a variety of reasons such as fence data not evaluated, nondeterministic state of a particular context etc.

public abstractStringgetFenceKey()

Returns the fence key that identifies this fence inAwarenessFence.

Returns
  • The fence key that identifies this fence inAwarenessFence. It is the same identifier that was used by the client to register the fence. This value may also be provided as part of theFenceQueryRequest.

public abstract longgetLastFenceUpdateTimeMillis()

Returns the last time the fence state was changed in milliseconds since epoch.

Returns
  • the last fence update time in milliseconds since epoch.

public abstract intgetPreviousState()

Returns the previous fence state.

Returns
  • The previous state of the fence inAwarenessFence.
    • TRUE indicates that the previous state of fence evaluation was true.
    • FALSEindicates that the previous state of fence evaluation was false.
    • UNKNOWNindicates an unknown previous fence evaluation state. This may be due to a variety of reasons such as fence data not evaluated, nondeterministic state of a particular context etc.