The method AudioManager.isWiredHeadsetOn() is deprecated from api level 14, how do we now detect if a wired headset is connected?
Try this solution. It's working in my case. May be this helps you!
IntentFilter iFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG); Intent iStatus = context.registerReceiver(null, iFilter); boolean isConnected = iStatus.getIntExtra("state", 0) == 1;