public interface

# SnapshotApi

com.google.android.gms.awareness.SnapshotApi

## Class Overview

Main entry point for the Awareness Snapshot API.

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

- Awareness API Guide

## Summary

Public Methods
abstract PendingResult<BeaconStateResult> | getBeaconState(GoogleApiClient client, Collection<BeaconState.TypeFilter> beaconTypes) Get the current information about nearby beacons.
abstract PendingResult<BeaconStateResult> | getBeaconState(GoogleApiClient client, TypeFilter... beaconTypes) Get the current information about nearby beacons.
abstract PendingResult<DetectedActivityResult> | getDetectedActivity(GoogleApiClient client) Get the user's current activity (e.g., running, walking, biking, driving, etc.).
abstract PendingResult<HeadphoneStateResult> | getHeadphoneState(GoogleApiClient client) Report whether headphones are plugged into the device.
abstract PendingResult<LocationResult> | getLocation(GoogleApiClient client) Get the device's current location (lat/lng).
abstract PendingResult<PlacesResult> | getPlaces(GoogleApiClient client) Get the device's current semantic location, or "place", which can include a name, place type, and address.
abstract PendingResult<WeatherResult> | getWeather(GoogleApiClient client) Get the current weather conditions (temperature, feels-like temperature, dewpoint, humidity, etc.) at the current device location.

## Public Methods

#### public abstract PendingResult<BeaconStateResult> getBeaconState (GoogleApiClient client, 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, `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 `PendingResult` with `BeaconStateResult`. Check the status via `getStatus()` 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 abstract PendingResult<BeaconStateResult> getBeaconState (GoogleApiClient client, 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, `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 `PendingResult` with `BeaconStateResult`. Check the status via `getStatus()` 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 abstract PendingResult<DetectedActivityResult> getDetectedActivity (GoogleApiClient client)

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.

##### Parameters

client | A `GoogleApiClient` instance.

##### Returns

- a `PendingResult` with `DetectedActivityResult`. Check the status via `getStatus()` 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 abstract PendingResult<HeadphoneStateResult> getHeadphoneState (GoogleApiClient client)

Report whether headphones are plugged into the device.

##### Parameters

client | A `GoogleApiClient` instance.

##### Returns

- a `PendingResult` with `HeadphoneStateResult`. Check the status via `getStatus()` to determine success or failure. If successful, use `getHeadphoneState()` to get the current headphone state.

#### public abstract PendingResult<LocationResult> getLocation (GoogleApiClient client)

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

client | A `GoogleApiClient` instance.

##### Returns

- a `PendingResult` with `LocationResult`. Check the status via `getStatus()` 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 abstract PendingResult<PlacesResult> getPlaces (GoogleApiClient client)

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.

##### Parameters

client | A `GoogleApiClient` instance.

##### Returns

- a `PendingResult` with `PlacesResult`. Check the status via `getStatus()` 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 abstract PendingResult<WeatherResult> getWeather (GoogleApiClient client)

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.

##### Parameters

client | A `GoogleApiClient` instance.

##### Returns

- a `PendingResult` with `WeatherResult`. Check the status via `getStatus()` 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.