HeadphoneState
Stay organized with collections
Save and categorize content based on your preferences.
Constant Summary
int |
PLUGGED_IN
|
Indicates that headphones are plugged into the
physical headphone jack. |
int |
UNPLUGGED
|
Indicates that there are no headphones plugged
into the physical headphone jack. |
Public Method Summary
abstract int |
getState()
Returns the current state of the headphones.
|
Constants
public static final int
PLUGGED_IN
Indicates that headphones are plugged into the physical headphone jack.
Constant Value: 1
public static final int
UNPLUGGED
Indicates that there are no headphones plugged into the physical headphone jack.
Constant Value: 2
Public Methods
public abstract int getState ()
Returns the current state of the headphones.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["The `HeadphoneState` interface provides information about the current state of headphones connected to a device."],["It defines two states: `PLUGGED_IN` (1) and `UNPLUGGED` (2), indicating whether headphones are connected to the physical headphone jack."],["The `getState()` method allows you to retrieve the current headphone state."]]],["The `HeadphoneState` interface defines the state of headphones. It provides two constants: `PLUGGED_IN` (value 1), indicating headphones are connected, and `UNPLUGGED` (value 2), signifying no headphones are connected. The `getState()` method returns the current headphone state, which will be either `PLUGGED_IN` or `UNPLUGGED`. These constants allow developers to check the connected status of physical headphones.\n"]]