FenceState
Stay organized with collections
Save and categorize content based on your preferences.
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
|
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
From interface android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR |
|
int |
PARCELABLE_WRITE_RETURN_VALUE |
|
Public Constructor Summary
Public Method Summary
static FenceState
|
extract
( Intent
intent) Extracts the fence state details from the intent.
|
abstract int |
|
abstract String
|
|
abstract long |
|
abstract int |
|
Inherited Method Summary
From class java.lang.Object
From interface android.os.Parcelable
abstract int |
describeContents
()
|
abstract void |
writeToParcel
( Parcel
arg0,
int arg1)
|
Constants
public static final int
FALSE
public static final int
TRUE
public static final int
UNKNOWN
Fence state is unknown, which can be due to no data received.
Constant Value:
0
Public Methods
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 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
()
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 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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eFenceState\u003c/code\u003e encapsulates the state of an AwarenessFence, including current, previous, and last update time.\u003c/p\u003e\n"],["\u003cp\u003eIt provides constants for fence states: \u003ccode\u003eTRUE\u003c/code\u003e, \u003ccode\u003eFALSE\u003c/code\u003e, and \u003ccode\u003eUNKNOWN\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can extract \u003ccode\u003eFenceState\u003c/code\u003e details from an Intent using the \u003ccode\u003eextract()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eMethods like \u003ccode\u003egetCurrentState()\u003c/code\u003e, \u003ccode\u003egetPreviousState()\u003c/code\u003e, and \u003ccode\u003egetLastFenceUpdateTimeMillis()\u003c/code\u003e provide access to state information.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetFenceKey()\u003c/code\u003e retrieves the identifier used to register the fence.\u003c/p\u003e\n"]]],[],null,["# FenceState\n\npublic abstract class **FenceState** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nimplements [Parcelable](//developer.android.com/reference/android/os/Parcelable.html) \nEncapsulates the state of a fence in [AwarenessFence](/android/reference/com/google/android/gms/awareness/fence/AwarenessFence).\nThe state includes the current and previous evaluation state and time of the last fence state\nupdate. \n\n### Constant Summary\n\n|-----|-----------------------------------------------------------------------------------------|---------------------------------------------------------------|\n| int | [FALSE](/android/reference/com/google/android/gms/awareness/fence/FenceState#FALSE) | Fence state is false. |\n| int | [TRUE](/android/reference/com/google/android/gms/awareness/fence/FenceState#TRUE) | Fence state is true. |\n| int | [UNKNOWN](/android/reference/com/google/android/gms/awareness/fence/FenceState#UNKNOWN) | Fence state is unknown, which can be due to no data received. |\n\n### Inherited Constant Summary\n\nFrom interface android.os.Parcelable \n\n|-----|-------------------------------|---|\n| int | CONTENTS_FILE_DESCRIPTOR | |\n| int | PARCELABLE_WRITE_RETURN_VALUE | |\n\n### Public Constructor Summary\n\n|---|---------------------------------------------------------------------------------------------------|\n| | [FenceState](/android/reference/com/google/android/gms/awareness/fence/FenceState#FenceState())() |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [FenceState](/android/reference/com/google/android/gms/awareness/fence/FenceState) | [extract](/android/reference/com/google/android/gms/awareness/fence/FenceState#extract(android.content.Intent))([Intent](//developer.android.com/reference/android/content/Intent.html) intent) Extracts the fence state details from the intent. |\n| abstract int | [getCurrentState](/android/reference/com/google/android/gms/awareness/fence/FenceState#getCurrentState())() Returns the current fence state. |\n| abstract [String](//developer.android.com/reference/java/lang/String.html) | [getFenceKey](/android/reference/com/google/android/gms/awareness/fence/FenceState#getFenceKey())() Returns the fence key that identifies this fence in [AwarenessFence](/android/reference/com/google/android/gms/awareness/fence/AwarenessFence). |\n| abstract long | [getLastFenceUpdateTimeMillis](/android/reference/com/google/android/gms/awareness/fence/FenceState#getLastFenceUpdateTimeMillis())() Returns the last time the fence state was changed in milliseconds since epoch. |\n| abstract int | [getPreviousState](/android/reference/com/google/android/gms/awareness/fence/FenceState#getPreviousState())() Returns the previous fence state. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface android.os.Parcelable \n\n|---------------|--------------------------------------------------------------------------------------------------|\n| abstract int | describeContents() |\n| abstract void | writeToParcel([Parcel](//developer.android.com/reference/android/os/Parcel.html) arg0, int arg1) |\n\nConstants\n---------\n\n#### public static final int\n**FALSE**\n\nFence state is false. \nConstant Value: 1 \n\n#### public static final int\n**TRUE**\n\nFence state is true. \nConstant Value: 2 \n\n#### public static final int\n**UNKNOWN**\n\nFence state is unknown, which can be due to no data received. \nConstant Value: 0\n\nPublic Constructors\n-------------------\n\n#### public **FenceState** ()\n\nPublic Methods\n--------------\n\n#### public static [FenceState](/android/reference/com/google/android/gms/awareness/fence/FenceState)\n**extract** ([Intent](//developer.android.com/reference/android/content/Intent.html) intent)\n\nExtracts the fence state details from the intent. \n\n##### Parameters\n\n| intent | The [Intent](//developer.android.com/reference/android/content/Intent.html) object received from registering a fence. |\n|--------|-----------------------------------------------------------------------------------------------------------------------|\n\n##### Returns\n\n- Information about the fence state. \n\n#### public abstract int **getCurrentState** ()\n\nReturns the current fence state. \n\n##### Returns\n\n- The state of the fence in [AwarenessFence](/android/reference/com/google/android/gms/awareness/fence/AwarenessFence).\n - [TRUE](/android/reference/com/google/android/gms/awareness/fence/FenceState#TRUE) indicates that the state of fence evaluation is true.\n - [FALSE](/android/reference/com/google/android/gms/awareness/fence/FenceState#FALSE) indicates that the state of fence evaluation is false.\n- [UNKNOWN](/android/reference/com/google/android/gms/awareness/fence/FenceState#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. \n\n#### public abstract [String](//developer.android.com/reference/java/lang/String.html) **getFenceKey** ()\n\nReturns the fence key that identifies this fence in [AwarenessFence](/android/reference/com/google/android/gms/awareness/fence/AwarenessFence). \n\n##### Returns\n\n- The fence key that identifies this fence in [AwarenessFence](/android/reference/com/google/android/gms/awareness/fence/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](/android/reference/com/google/android/gms/awareness/fence/FenceQueryRequest). \n\n#### public abstract long **getLastFenceUpdateTimeMillis** ()\n\nReturns the last time the fence state was changed in milliseconds since epoch. \n\n##### Returns\n\n- the last fence update time in milliseconds since epoch. \n\n#### public abstract int **getPreviousState** ()\n\nReturns the previous fence state. \n\n##### Returns\n\n- The previous state of the fence in [AwarenessFence](/android/reference/com/google/android/gms/awareness/fence/AwarenessFence).\n - [TRUE](/android/reference/com/google/android/gms/awareness/fence/FenceState#TRUE) indicates that the previous state of fence evaluation was true.\n - [FALSE](/android/reference/com/google/android/gms/awareness/fence/FenceState#FALSE) indicates that the previous state of fence evaluation was false.\n - [UNKNOWN](/android/reference/com/google/android/gms/awareness/fence/FenceState#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."]]