Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
fix: list only smart phones for scanning bluetooth devices
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-prabhakar committed Feb 18, 2020
1 parent c955438 commit f223b1c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.odk.share.views.ui.bluetooth;

import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -48,8 +49,10 @@ public void setDevices(List<BluetoothDevice> dateSet) {
}

public void addDevice(BluetoothDevice bluetoothDevice) {
if (!bluetoothDeviceList.contains(bluetoothDevice)) {
this.bluetoothDeviceList.add(bluetoothDevice);
if (!bluetoothDeviceList.contains(bluetoothDevice) && bluetoothDevice.getBluetoothClass().getDeviceClass() != -1) {
if (bluetoothDevice.getBluetoothClass().getDeviceClass() == BluetoothClass.Device.PHONE_SMART) {
this.bluetoothDeviceList.add(bluetoothDevice);
}
}
notifyDataSetChanged();
}
Expand Down

0 comments on commit f223b1c

Please sign in to comment.