Summary: Nested Classes | Constants | Inherited Constants | Ctors | Methods | Inherited Methods | [Expand All]
public abstract class

# FenceState

extends Object
implements SafeParcelable

java.lang.Object
↳ | com.google.android.gms.awareness.fence.FenceState

## Class Overview

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

## Summary

Nested Classes
@interface | FenceState.State | Valid values for a Fence state represented in `AwarenessFence`.

Constants
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.

[Expand] Inherited Constants
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
String | NULL |
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Public Constructors
| FenceState()

Public Methods
static FenceState | extract(Intent intent) Extracts the fence state details from the intent.
abstract int | getCurrentState() Returns the current fence state.
abstract String | 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.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final int FALSE

Fence state is false.

Constant Value: 1 (0x00000001)

#### public static final int TRUE

Fence state is true.

Constant Value: 2 (0x00000002)

#### public static final int UNKNOWN

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

Constant Value: 0 (0x00000000)

## Public Constructors

#### public FenceState ()

## Public Methods

#### public static FenceState extract (Intent intent)

Extracts the fence state details from the intent.

##### Parameters

intent | The `Intent` object received from registering a fence.

##### Returns

- Information about the fence state.

#### public abstract int getCurrentState ()

Returns the current fence state.

##### Returns

- The `FenceState.State` of the fence in `AwarenessFence`.
  - `TRUE` indicates that the state of fence evaluation is true.
  - `FALSE` indicates that the state of fence evaluation is false.
  - `UNKNOWN` indicates an Unknown fence evaluation state. This can occur for a number of reasons, for example fence data was not evaluated, a particular context was in a nondeterministic state, and so on.

#### public abstract String getFenceKey ()

Returns the fence key that identifies this fence in `AwarenessFence`.

##### Returns

- The fence key that identifies this fence in `AwarenessFence`. It is the same identifier that was used by the client to register the fence. This value may also be provided as part of the `FenceQueryRequest`.

#### public abstract long getLastFenceUpdateTimeMillis ()

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 int getPreviousState ()

Returns the previous fence state.

##### Returns

- The previous `FenceState.State` of the fence in `AwarenessFence`.
  - `TRUE` indicates that the previous state of fence evaluation was true.
  - `FALSE` indicates that the previous state of fence evaluation was false.
  - `UNKNOWN` indicates 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.