Summary: Methods | Inherited Methods | [Expand All]
public final class

# HeadphoneFence

extends Object

java.lang.Object
↳ | com.google.android.gms.awareness.fence.HeadphoneFence

## Class Overview

Use this class to create headphone state fences.

Note: Values that indicate a changing state are momentarily `TRUE` for about 5 seconds, then automatically revert to `FALSE`.

Please be sure to follow the guidelines in the Awareness API Guide .

## Summary

Public Methods
static AwarenessFence | during(int headphoneState) This fence is in the `TRUE` state when the headphones are in the specified state.
static AwarenessFence | pluggingIn() This fence is momentarily (about 5 seconds) in the `TRUE` state when headphones are plugged in to the device.
static AwarenessFence | unplugging() This fence is momentarily (about 5 seconds) in the `TRUE` state when headphones are unplugged from the device.

[Expand] Inherited Methods
From class java.lang.Object
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()

## Public Methods

#### public static AwarenessFence during (int headphoneState)

This fence is in the `TRUE` state when the headphones are in the specified state.

##### Parameters

headphoneState | Valid values are `PLUGGED_IN` or `UNPLUGGED`

##### Returns

- `AwarenessFence`

#### public static AwarenessFence pluggingIn ()

This fence is momentarily (about 5 seconds) in the `TRUE` state when headphones are plugged in to the device.

##### Returns

- `AwarenessFence`

#### public static AwarenessFence unplugging ()

This fence is momentarily (about 5 seconds) in the `TRUE` state when headphones are unplugged from the device.

##### Returns

- `AwarenessFence`