FenceState

public abstract class FenceState extends Object
implements Parcelable

This class is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

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.

Constant Summary

int FALSE This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.
int TRUE This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.
int UNKNOWN This constant is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

Inherited Constant Summary

Public Constructor Summary

Public Method Summary

static FenceState
extract(Intent intent)
This method is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.
abstract int
getCurrentState()
This method is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.
abstract String
getFenceKey()
This method is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.
abstract long
getLastFenceUpdateTimeMillis()
This method is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.
abstract int
getPreviousState()
This method is deprecated. The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

Inherited Method Summary

Constants

public static final int FALSE

This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

Fence state is false.

Constant Value: 1

public static final int TRUE

This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

Fence state is true.

Constant Value: 2

public static final int UNKNOWN

This constant is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

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

Constant Value: 0

Public Constructors

public FenceState ()

Public Methods

public static FenceState extract (Intent intent)

This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

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

This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

Returns the current fence state.

Returns
  • The 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 may be due to a variety of reasons such as fence data not evaluated, nondeterministic state of a particular context etc.

public abstract String getFenceKey ()

This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

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

This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

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

This method is deprecated.
The Awareness API is deprecated and will be turned down in a future Google Play services release, as early as January 2027. There is no direct replacement.

Returns the previous fence state.

Returns
  • The previous 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.