Monday, 24 September 2018

Check if headset is connected on different API levels

I have an application that targets API Level 19+. I need to check if headset is connected (either of wired or bluetooth).

I see that AudioManager.isWiredHeadsetOn() is deprecated starting from API Level 16 and the documentation offers to use AudioManager.getDevices() which was introduced only starting from API Level 23.

Question: What is the proper way to check if headset is connected for API levels 16 - 22?

Note: I know that I can still use deprecated method, but I don't want to. If they deprecated it they should have introduced a replacement API (which I though can't find).



from Check if headset is connected on different API levels

No comments:

Post a Comment