Skip to content

Commit 474541f

Browse files
author
antoniohof
committed
detect bluetooth headset
1 parent 2a30e79 commit 474541f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Android/src/com/davikingcode/DetectHeadset/DetectHeadset.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public DetectHeadset(Context context) {
1313
}
1414

1515
public boolean _Detect() {
16-
17-
return myAudioManager.isWiredHeadsetOn();
16+
if(myAudioManager.isWiredHeadsetOn() || myAudioManager.isBluetoothA2dpOn()){
17+
return true;
18+
}else false;
1819
}
1920
}

Assets/Plugins/iOS/DetectHeadset.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ bool _Detect() {
99
for (AVAudioSessionPortDescription* desc in [route outputs]) {
1010
if ([[desc portType] isEqualToString:AVAudioSessionPortHeadphones])
1111
return true;
12+
if ([[desc portType] isEqualToString:AVAudioSessionPortBluetoothHFP])
13+
return true;
1214
}
1315

1416
return false;

0 commit comments

Comments
 (0)