Does anyone know how I can detect if the headphone jack on a device is unplugged on Android? I have a music player and I need to pause the music when the headphones are unplugged. The closest thing I have found is using the AudioManager
. Is that the right direction to go?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How can I create this custom Bottom Navigation on
- How to maintain order of key-value in DataFrame sa
- Can we recover audio from MFCC coefficients?
This is what I ended up doing:
I found the answer at this link: http://developer.android.com/training/managing-audio/audio-output.html