diff --git a/Android/src/com/davikingcode/DetectHeadset/DetectHeadset.java b/Android/src/com/davikingcode/DetectHeadset/DetectHeadset.java index 1f2661c..42bee8c 100644 --- a/Android/src/com/davikingcode/DetectHeadset/DetectHeadset.java +++ b/Android/src/com/davikingcode/DetectHeadset/DetectHeadset.java @@ -11,18 +11,24 @@ public DetectHeadset(Context context) { myAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); } - public boolean _Detect() { + public boolean _Detect() + { //Added validation for newer api's above 26. - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) + { AudioDeviceInfo[] audioDeviceInfos = myAudioManager.getDevices(AudioManager.GET_DEVICES_INPUTS); - for (int i=0;i