How to detect if device has 3.5 mm audio jack?
Asked Answered
W

1

6

I've gone through many posts and forum articles but didn't find anything related to my requirement. Lots of new android devices are coming with no headphone jack built in and I don't need to deal with those devices.

Through PackageManger I could only detect feature AUDIO_OUTPUT.

Is there any effective way from which I can check whether 3.5 mm audio jack exists in device?

Wart answered 15/2, 2018 at 7:0 Comment(3)
i search allot but could not fine relevant.Varve
Out of curiosity, why do you need to know? Presumably anyone who has a device without an analogue audio jack could just plug an adapter into their phone to add one, and use your app?Agential
@MattGibson It's a diagnostic app, there are many portions to diagnose including headphone as well, which insures that the audio jack is also working fine.. So I want to check if this jack exists else skip the test. Because there is no meaning in checking usb digital audio since it's the only port to charge device. Generally if its charging & being connected to pc, then the port should be fine for headphones too. :)Wart
E
3

I don't think it is possible that the app can determine if a device has a 3.5 mm audio jack.

From: https://source.android.com/devices/audio/usb#hostApplications

the line:

There are no APIs specific to USB digital audio.

Doesn't give me much hope especially as in that same document earlier mentions when talking about TRS Mini (audio jack) and USB Audio:

Note: This is an artificial comparison, since a real Android device would probably have both options available.

Which may have been true when the document was first written but as you've noted now less guaranteed.

A scan of the Android Compatibility Definition Document shows in Android CDD Section 7.8.2 Audio that no distinction is made between a 3.5mm audio jack and USB audio connection.

One suggestion is to submit a feature request to the Android Issue Tracker with as detailed use case as to why the legacy headphone jack should be a feature flag.

Executant answered 15/2, 2018 at 8:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.