Skip to content

Commit

Permalink
Merge pull request #199 from NordicSemiconductor/improvement/bonded-le
Browse files Browse the repository at this point in the history
Hiding Classic Bluetooth devices on Saved tab
  • Loading branch information
philips77 authored Oct 21, 2024
2 parents 8e95df0 + 3fa980b commit 1f16dc2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import androidx.core.app.ActivityCompat;
import androidx.lifecycle.AndroidViewModel;

import java.util.HashSet;
import java.util.Set;

import javax.inject.Inject;
Expand Down Expand Up @@ -74,7 +75,12 @@ public void showDevices() {
if (ActivityCompat.checkSelfPermission(getApplication(), Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
return;
}
final Set<BluetoothDevice> devices = adapter.getBondedDevices();
final Set<BluetoothDevice> devices = new HashSet<>();
for (BluetoothDevice device : adapter.getBondedDevices()) {
if (device.getType() != BluetoothDevice.DEVICE_TYPE_CLASSIC) {
devices.add(device);
}
}
devicesLiveData.setDevices(devices);
if (!devices.isEmpty()) {
scannerStateLiveData.recordFound();
Expand Down

0 comments on commit 1f16dc2

Please sign in to comment.