SnapshotClient

public class SnapshotClient extends GoogleApi<AwarenessOptions>

Main entry point for the Awareness Snapshot API.

Inherited Field Summary

protected final GoogleApiManager zabo

Public Method Summary

Task<BeaconStateResponse>
getBeaconState(Collection<BeaconState.TypeFilter> beaconTypes)
Gets the current information about nearby beacons.
Task<BeaconStateResponse>
getBeaconState(TypeFilter... beaconTypes)
Gets the current information about nearby beacons.
Task<DetectedActivityResponse>
getDetectedActivity()
Gets the user's current activity (e.g., running, walking, biking, driving, etc.).
Task<HeadphoneStateResponse>
getHeadphoneState()
Reports whether headphones are plugged into the device.
Task<LocationResponse>
getLocation()
Gets the device's current location (lat/lng).
Task<TimeIntervalsResponse>
getTimeIntervals()
Gets the semantic time intervals for the to the current time and location.

Inherited Method Summary

GoogleApiClient
asGoogleApiClient()
ClientSettings.Builder
createClientSettingsBuilder()
Task<Boolean>
disconnectService()
<A extends Api.AnyClient, T extends ApiMethodImpl<? extends Result, A>> T
doBestEffortWrite(T arg0)
<TResult, A extends Api.AnyClient> Task<TResult>
doBestEffortWrite(TaskApiCall<A, TResult> arg0)
<A extends Api.AnyClient, T extends ApiMethodImpl<? extends Result, A>> T
doRead(T arg0)
<TResult, A extends Api.AnyClient> Task<TResult>
doRead(TaskApiCall<A, TResult> arg0)
<A extends Api.AnyClient> Task<Void>
doRegisterEventListener(RegistrationMethods<A, ?> arg0)
<A extends Api.AnyClient, T extends RegisterListenerMethod<A, ?>, U extends UnregisterListenerMethod<A, ?>> Task<Void>
doRegisterEventListener(T arg0, U arg1)
Task<Boolean>
doUnregisterEventListener(ListenerKey<?> arg0)
<TResult, A extends Api.AnyClient> Task<TResult>
doWrite(TaskApiCall<A, TResult> arg0)
<A extends Api.AnyClient, T extends ApiMethodImpl<? extends Result, A>> T
doWrite(T arg0)
final Api<AwarenessOptions>
getApi()
ApiKey<AwarenessOptions>
getApiKey()
AwarenessOptions
getApiOptions()
Context
getApplicationContext()
final int
getInstanceId()
Looper
getLooper()
<L> ListenerHolder<L>
registerListener(L arg0, String arg1)
zace
zaa(Context arg0, Handler arg1)
Api.Client
zaa(Looper arg0, zaa<AwarenessOptions> arg1)
Object
clone()
boolean
equals(Object arg0)
void
finalize()
final Class<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()
abstract ApiKey<AwarenessOptions>
getApiKey()

Public Methods

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

Gets 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 The types of beacon attachments to return. See Beacons for details about beacon attachments.
Returns
Throws
SecurityException Thrown if a required permission is missing.

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

Gets 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 The types of beacon attachments to return. See Beacons for details about beacon attachments.
Returns
Throws
SecurityException Thrown if a required permission is missing.

public Task<DetectedActivityResponse> getDetectedActivity ()

Gets 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
Returns
Throws
SecurityException Thrown if a required permission is missing.

public Task<HeadphoneStateResponse> getHeadphoneState ()

Reports whether headphones are plugged into the device.

Returns

public Task<LocationResponse> getLocation ()

Gets 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
Throws
SecurityException Thrown if a required permission is missing.

public Task<TimeIntervalsResponse> getTimeIntervals ()

Gets 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.

Returns
Throws
SecurityException Thrown if a required permission is missing.