Awareness
Stay organized with collections
Save and categorize content based on your preferences.
The main entry point for the Awareness service.
Field Summary
public static final Api
< AwarenessOptions
> |
API
|
This field is deprecated. Use
#getFenceClient or #getSnapshotClient instead.
|
public static final FenceApi
|
FenceApi
|
This field is deprecated. Use
#getFenceClient instead.
|
public static final SnapshotApi
|
SnapshotApi
|
This field is deprecated. Use
#getSnapshotClient instead.
|
Inherited Method Summary
From class java.lang.Object
Fields
This field is deprecated.Use #getFenceClient or #getSnapshotClient instead.
API token indicating use of the Awareness when building a GoogleApiClient
.
public static final FenceApi
FenceApi
This field is deprecated.Use #getFenceClient instead.
public static final SnapshotApi
SnapshotApi
This field is deprecated.Use #getSnapshotClient instead.
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\u003eAwareness\u003c/code\u003e is the main entry point for using the Awareness service on Android.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to create \u003ccode\u003eFenceClient\u003c/code\u003e and \u003ccode\u003eSnapshotClient\u003c/code\u003e instances for accessing Awareness features.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFenceClient\u003c/code\u003e allows you to work with fences, which are conditions that trigger actions based on user context.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSnapshotClient\u003c/code\u003e enables you to retrieve snapshots of current user context data, like location, weather, or activity.\u003c/p\u003e\n"],["\u003cp\u003eOlder fields like \u003ccode\u003eAPI\u003c/code\u003e, \u003ccode\u003eFenceApi\u003c/code\u003e, and \u003ccode\u003eSnapshotApi\u003c/code\u003e are deprecated in favor of the newer client-based approach.\u003c/p\u003e\n"]]],["The `Awareness` class is the central hub for the Awareness service. Key actions involve creating instances of `FenceClient` and `SnapshotClient`. To create a new `FenceClient`, use `getFenceClient` with either an `Activity` or `Context`. Similarly, `getSnapshotClient` can be used with an `Activity` or `Context` to create a `SnapshotClient`. Deprecated fields include `API`, `FenceApi`, and `SnapshotApi`, advising to utilize `getFenceClient` or `getSnapshotClient` instead.\n"],null,["# Awareness\n\npublic final class **Awareness** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nThe main entry point for the Awareness service. \n\n### Field Summary\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| public static final [Api](/android/reference/com/google/android/gms/common/api/Api)\\\u003c[AwarenessOptions](/android/reference/com/google/android/gms/awareness/AwarenessOptions)\\\u003e | [API](/android/reference/com/google/android/gms/awareness/Awareness#API) | *This field is deprecated. Use #getFenceClient or #getSnapshotClient instead.* |\n| public static final [FenceApi](/android/reference/com/google/android/gms/awareness/FenceApi) | [FenceApi](/android/reference/com/google/android/gms/awareness/Awareness#FenceApi) | *This field is deprecated. Use #getFenceClient instead.* |\n| public static final [SnapshotApi](/android/reference/com/google/android/gms/awareness/SnapshotApi) | [SnapshotApi](/android/reference/com/google/android/gms/awareness/Awareness#SnapshotApi) | *This field is deprecated. Use #getSnapshotClient instead.* |\n\n### Public Method Summary\n\n|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient) | [getFenceClient](/android/reference/com/google/android/gms/awareness/Awareness#getFenceClient(android.app.Activity))([Activity](//developer.android.com/reference/android/app/Activity.html) activity) Creates a new instance of [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient) for use in an [Activity](//developer.android.com/reference/android/app/Activity.html). |\n| static [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient) | [getFenceClient](/android/reference/com/google/android/gms/awareness/Awareness#getFenceClient(android.content.Context))([Context](//developer.android.com/reference/android/content/Context.html) context) Creates a new instance of [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient) for use in a non-activity [Context](//developer.android.com/reference/android/content/Context.html). |\n| static [SnapshotClient](/android/reference/com/google/android/gms/awareness/SnapshotClient) | [getSnapshotClient](/android/reference/com/google/android/gms/awareness/Awareness#getSnapshotClient(android.app.Activity))([Activity](//developer.android.com/reference/android/app/Activity.html) activity) Creates a new instance of [SnapshotClient](/android/reference/com/google/android/gms/awareness/SnapshotClient) for use in an [Activity](//developer.android.com/reference/android/app/Activity.html). |\n| static [SnapshotClient](/android/reference/com/google/android/gms/awareness/SnapshotClient) | [getSnapshotClient](/android/reference/com/google/android/gms/awareness/Awareness#getSnapshotClient(android.content.Context))([Context](//developer.android.com/reference/android/content/Context.html) context) Creates a new instance of [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient) for use in a non-activity [Context](//developer.android.com/reference/android/content/Context.html). |\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\nFields\n------\n\n#### public static final [Api](/android/reference/com/google/android/gms/common/api/Api)\\\u003c[AwarenessOptions](/android/reference/com/google/android/gms/awareness/AwarenessOptions)\\\u003e\n**API**\n\n**This field is deprecated.** \n\nUse #getFenceClient or #getSnapshotClient instead. \nAPI token indicating use of the Awareness when building a [GoogleApiClient](/android/reference/com/google/android/gms/common/api/GoogleApiClient). \n\n#### public static final [FenceApi](/android/reference/com/google/android/gms/awareness/FenceApi)\n**FenceApi**\n\n**This field is deprecated.** \n\nUse #getFenceClient instead. \n\n#### public static final [SnapshotApi](/android/reference/com/google/android/gms/awareness/SnapshotApi)\n**SnapshotApi**\n\n**This field is deprecated.** \n\nUse #getSnapshotClient instead. \n\nPublic Methods\n--------------\n\n#### public static [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient)\n**getFenceClient** ([Activity](//developer.android.com/reference/android/app/Activity.html) activity)\n\nCreates a new instance of [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient)\nfor use in an [Activity](//developer.android.com/reference/android/app/Activity.html). \n\n#### public static [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient)\n**getFenceClient** ([Context](//developer.android.com/reference/android/content/Context.html) context)\n\nCreates a new instance of [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient)\nfor use in a non-activity [Context](//developer.android.com/reference/android/content/Context.html). \n\n#### public static [SnapshotClient](/android/reference/com/google/android/gms/awareness/SnapshotClient)\n**getSnapshotClient** ([Activity](//developer.android.com/reference/android/app/Activity.html) activity)\n\nCreates a new instance of [SnapshotClient](/android/reference/com/google/android/gms/awareness/SnapshotClient)\nfor use in an [Activity](//developer.android.com/reference/android/app/Activity.html). \n\n#### public static [SnapshotClient](/android/reference/com/google/android/gms/awareness/SnapshotClient)\n**getSnapshotClient** ([Context](//developer.android.com/reference/android/content/Context.html) context)\n\nCreates a new instance of [FenceClient](/android/reference/com/google/android/gms/awareness/FenceClient)\nfor use in a non-activity [Context](//developer.android.com/reference/android/content/Context.html)."]]