Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.alexkorep">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,19 @@ public void onHostResume() {
return;
}
final AudioManager audioManager = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
for (AudioDeviceInfo device : devices) {
final int type = device.getType();
if (type == AudioDeviceInfo.TYPE_BLUETOOTH_A2DP || type == AudioDeviceInfo.TYPE_BLUETOOTH_SCO) {
// Device is found
final String deviceName = device.getProductName().toString();
onChange(deviceName);
return;
try {
AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
for (AudioDeviceInfo device : devices) {
final int type = device.getType();
if (type == AudioDeviceInfo.TYPE_BLUETOOTH_A2DP || type == AudioDeviceInfo.TYPE_BLUETOOTH_SCO) {
// Device is found
final String deviceName = device.getProductName().toString();
onChange(deviceName);
return;
}
}
} catch(NoSuchMethodError e) {
//ignore in case of error
}
// No devices found
onChange("");
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"licenseFilename": "LICENSE",
"readmeFilename": "README.md",
"peerDependencies": {
"react": "^16.5.0",
"react": "^17.0.2",
"react-native": ">=0.57.0-rc.0 <1.0.x"
},
"devDependencies": {
"@react-native-community/eslint-config": "^0.0.5",
"eslint": "^6.5.1",
"react": "^16.5.0",
"react": "^17.0.2",
"react-native": "^0.61.4"
}
}