AI-generated Key Takeaways
-
The SnapshotApi interface is deprecated and you should use
getSnapshotClient(Activity)instead. -
This deprecated API uses
GoogleApiClientand requires an instance to be used. -
Various methods within this deprecated API, such as
getBeaconState,getDetectedActivity,getHeadphoneState,getLocation, andgetTimeIntervals, are also deprecated and have corresponding replacements inSnapshotClient. -
Using methods like
getBeaconState,getDetectedActivity,getLocation, andgetTimeIntervalsmay require specific Android permissions and user consent at runtime. -
These deprecated methods return a
PendingResultwhich can be checked for status and used to retrieve specific data like beacon state, detected activity, location, headphone state, or time intervals.
This interface is deprecated.
Use getSnapshotClient(Activity)
instead.
Deprecated entry point for the Awareness Snapshot API using GoogleApiClient
.
The methods must be used in conjunction with a GoogleApiClient
instance. For example:
new GoogleApiClient.Builder(context)
.addApi(Awareness.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build()
See Also
Public Method Summary
| abstract PendingResult < BeaconStateResult > | |
| abstract PendingResult < BeaconStateResult > | |
| abstract PendingResult < DetectedActivityResult > | |
| abstract PendingResult < HeadphoneStateResult > | |
| abstract PendingResult < LocationResult > | |
| abstract PendingResult < TimeIntervalsResult > |
Public Methods
public abstract PendingResult < BeaconStateResult > getBeaconState ( GoogleApiClient client, Collection < BeaconState.TypeFilter > beaconTypes)
This method is deprecated.
Use getBeaconState(BeaconState.TypeFilter...)
instead.
Get the current information about nearby beacons. Note that beacon snapshots are
only available on devices running API level 18 or higher. If calling from a device
running API level 17 or earlier, getStatus()
will return status code API_NOT_AVAILABLE
.
To use this method, your app must declare the android.permission.ACCESS_FINE_LOCATION
permission in AndroidManifest.xml,
and the user must provide consent at runtime.
Parameters
| client | A GoogleApiClient
instance. |
|---|---|
| beaconTypes | The types of beacon attachments to return. See Beacons for details about beacon attachments. |
Returns
- a
PendingResultwithBeaconStateResult. Check the status viagetStatus()to determine success or failure. If successful, usegetBeaconState()to get data on the nearby beacons.
Throws
public abstract PendingResult < BeaconStateResult > getBeaconState ( GoogleApiClient client, TypeFilter... beaconTypes)
This method is deprecated.
Use getBeaconState(BeaconState.TypeFilter...)
instead.
Get the current information about nearby beacons. Note that beacon snapshots are
only available on API level 18 or higher. If calling from a device prior to API level
18, getStatus()
will return status code API_NOT_AVAILABLE
.
To use this method, your app must declare the android.permission.ACCESS_FINE_LOCATION
permission in AndroidManifest.xml,
and the user must provide consent at runtime.
Parameters
| client | A GoogleApiClient
instance. |
|---|---|
| beaconTypes | The types of beacon attachments to return. See Beacons for details about beacon attachments. |
Returns
- a
PendingResultwithBeaconStateResult. Check the status viagetStatus()to determine success or failure. If successful, usegetBeaconState()to get data on the nearby beacons.
Throws
public abstract PendingResult < DetectedActivityResult > getDetectedActivity ( GoogleApiClient client)
This method is deprecated.
Use getDetectedActivity()
instead.
Get the user's current activity (e.g., running, walking, biking, driving, etc.).
To call this function, a different permission is required depending on your Android API level:
- For Android 10 (API level 29) and later: android.permission.ACTIVITY_RECOGNITION permission
- For Android 9 (API level 28) and earlier: com.google.android.gms.permission.ACTIVITY_RECOGNITION permission
Parameters
Returns
- a
PendingResultwithDetectedActivityResult. Check the status viagetStatus()to determine success or failure. If successful, then usegetActivityRecognitionResult()to get the current activity.
Throws
public abstract PendingResult < HeadphoneStateResult > getHeadphoneState ( GoogleApiClient client)
This method is deprecated.
Use getHeadphoneState()
instead.
Report whether headphones are plugged into the device.
Parameters
Returns
- a
PendingResultwithHeadphoneStateResult. Check the status viagetStatus()to determine success or failure. If successful, usegetHeadphoneState()to get the current headphone state.
public abstract PendingResult < LocationResult > getLocation ( GoogleApiClient client)
This method is deprecated.
Use getLocation()
instead.
Get the device's current location (lat/lng).
To use this method, your app must declare the android.permission.ACCESS_FINE_LOCATION
permission in AndroidManifest.xml
, and the user must provide consent at runtime.
Parameters
Returns
- a
PendingResultwithLocationResult. Check the status viagetStatus()to determine success or failure. If successful, then usegetLocation()to get the current device location.
Throws
public abstract PendingResult < TimeIntervalsResult > getTimeIntervals ( GoogleApiClient client)
This method is deprecated.
Use getTimeIntervals()
instead.
Get the semantic time intervals for the to the current time and location. As
examples, some attributes are: TIME_INTERVAL_MORNING
, TIME_INTERVAL_AFTERNOON
, TIME_INTERVAL_EVENING
, TIME_INTERVAL_NIGHT
, TIME_INTERVAL_WEEKDAY
, TIME_INTERVAL_WEEKEND
, TIME_INTERVAL_HOLIDAY
.
To use this method, your app must declare the android.permission.ACCESS_FINE_LOCATION
permission in AndroidManifest.xml,
and the user must provide consent at runtime.
Parameters
Returns
- a
PendingResultwithTimeIntervalsResult. Check the status viagetStatus()to determine success or failure. If successful, then usegetTimeIntervals()to get the attributes of the current day and time.

