|
@@ -15,8 +15,6 @@ import android.util.Log;
|
15
|
15
|
|
16
|
16
|
import com.facebook.react.bridge.ReactContext;
|
17
|
17
|
|
18
|
|
-import java.util.List;
|
19
|
|
-
|
20
|
18
|
/**
|
21
|
19
|
* Helper class to detect and handle Bluetooth device changes. It monitors
|
22
|
20
|
* Bluetooth headsets being connected / disconnected and notifies the module
|
|
@@ -81,9 +79,6 @@ public class BluetoothHeadsetMonitor {
|
81
|
79
|
audioManager
|
82
|
80
|
= (AudioManager)
|
83
|
81
|
reactContext.getSystemService(Context.AUDIO_SERVICE);
|
84
|
|
- bluetoothAdapter = null;
|
85
|
|
- bluetoothHeadset = null;
|
86
|
|
- bluetoothProfileListener = null;
|
87
|
82
|
mainThreadHandler = new Handler(Looper.getMainLooper());
|
88
|
83
|
}
|
89
|
84
|
|
|
@@ -106,9 +101,8 @@ public class BluetoothHeadsetMonitor {
|
106
|
101
|
if (bluetoothHeadset == null) {
|
107
|
102
|
headsetAvailable = false;
|
108
|
103
|
} else {
|
109
|
|
- List<BluetoothDevice> devices
|
110
|
|
- = bluetoothHeadset.getConnectedDevices();
|
111
|
|
- headsetAvailable = !devices.isEmpty();
|
|
104
|
+ headsetAvailable
|
|
105
|
+ = !bluetoothHeadset.getConnectedDevices().isEmpty();
|
112
|
106
|
}
|
113
|
107
|
audioModeModule.onAudioDeviceChange();
|
114
|
108
|
}
|