SnapshotClient | Doclava
public class

SnapshotClient

extends GoogleApi<AwarenessOptions>
java.lang.Object
   ↳ com.google.android.gms.common.api.GoogleApi<com.google.android.gms.awareness.AwarenessOptions>
     ↳ com.google.android.gms.awareness.SnapshotClient

Class Overview

Main entry point for the Awareness Snapshot API.

See also:

Summary

Public Methods
Task<BeaconStateResponse> getBeaconState(Collection<BeaconState.TypeFilter> beaconTypes)
Get the current information about nearby beacons.
Task<BeaconStateResponse> getBeaconState(TypeFilter... beaconTypes)
Get the current information about nearby beacons.
Task<DetectedActivityResponse> getDetectedActivity()
Get the user's current activity (e.g., running, walking, biking, driving, etc.).
Task<HeadphoneStateResponse> getHeadphoneState()
Report whether headphones are plugged into the device.
Task<LocationResponse> getLocation()
Get the device's current location (lat/lng).
Task<PlacesResponse> getPlaces()
Get the device's current semantic location, or "place", which can include a name, place type, and address.
Task<WeatherResponse> getWeather()
Get the current weather conditions (temperature, feels-like temperature, dewpoint, humidity, etc.) at the current device location.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public Task<BeaconStateResponse> getBeaconState (Collection<BeaconState.TypeFilter> beaconTypes)

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, the Task will fail and calling getStatusCode() 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
beaconTypes Collection:The types of beacon attachments to return. See Beacons for details about beacon attachments.

Returns
Task<BeaconStateResponse> a Task with BeaconStateResponse. Use isSuccessful() to determine success or failure. If successful, use getBeaconState() to get data on the nearby beacons.

Throws
SecurityException Thrown if a required permission is missing.

public Task<BeaconStateResponse> getBeaconState (TypeFilter... beaconTypes)

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, the Task will fail and calling getStatusCode() 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
beaconTypes TypeFilter:The types of beacon attachments to return. See Beacons for details about beacon attachments.

Returns
Task<BeaconStateResponse> a Task with BeaconStateResponse. Use isSuccessful() to determine success or failure. If successful, use getBeaconState() to get data on the nearby beacons.

Throws
SecurityException Thrown if a required permission is missing.

public Task<DetectedActivityResponse> getDetectedActivity ()

Get the user's current activity (e.g., running, walking, biking, driving, etc.).

To use this method, your app must declare the com.google.android.gms.permission.ACTIVITY_RECOGNITION permission in AndroidManifest.xml, and the user must provide consent at runtime.

Returns
Task<DetectedActivityResponse> a Task with DetectedActivityResponse. Use isSuccessful() to determine success or failure. If successful, then use getActivityRecognitionResult() to get the current activity.

Throws
SecurityException Thrown if a required permission is missing.

public Task<HeadphoneStateResponse> getHeadphoneState ()

Report whether headphones are plugged into the device.

Returns
Task<HeadphoneStateResponse> a Task with HeadphoneStateResponse. Use isSuccessful() to determine success or failure. If successful, use getHeadphoneState() to get the current headphone state.

public Task<LocationResponse> getLocation ()

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.

Returns
Task<LocationResponse> a Task with LocationResponse. Use isSuccessful() to determine success or failure. If successful, then use getLocation() to get the current device location.

Throws
SecurityException Thrown if a required permission is missing.

public Task<PlacesResponse> getPlaces ()

Get the device's current semantic location, or "place", which can include a name, place type, and address.

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.

Returns
Task<PlacesResponse> a Task with PlacesResponse. Use isSuccessful() to determine success or failure. If successful, then use getPlaceLikelihoods() to get the current place information.

Throws
SecurityException Thrown if a required permission is missing.

public Task<WeatherResponse> getWeather ()

Get the current weather conditions (temperature, feels-like temperature, dewpoint, humidity, etc.) at the current device location.

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.

Returns
Task<WeatherResponse> a Task with WeatherResponse. Check isSuccessful() to determine success or failure. If successful, then use getWeather() to get the current weather state.

Throws
SecurityException Thrown if a required permission is missing.