블루투스로는 적어도 두 개의 장치가 작동하지 않지만 내 응용 프로그램에서는 페어링 된 장치가 하나만 있음을 확신합니다. 나는 이미 블루투스 허가를 받았고 문제가 어디 있는지 이해하지 못합니다. 그것을 찾을 수 있습니까?블루투스 검색 관련 문제 Android
//Scan Function
void startScan(){
adapter.clear(); //List View cleared
deviceList = btAdapter.getBondedDevices(); //Paired Device
for (BluetoothDevice bd : deviceList) //Adding Paired Device
adapter.add(bd.getName() + "\n" + bd.getAddress()+"\t (Paired)");
//Init of Broadcast Receiver
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(BluetoothDevice.ACTION_FOUND.equals(action)){ //Device Found
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); //Extractind Device Info
adapter.add(device.getName()+"\t"+device.getAddress()); //Adding Device to List View
}
}
};
//Broadcast Receiver Registration
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(receiver,filter);
btAdapter.startDiscovery(); //Scan start
}
과에서해야 가능하면 블루투스 장치의 당신의 발견을 시작? 'btAdapter.startDiscovery();'를 사용하여? –
예,이 방법으로 작동하지 않습니다 –
마시맬로를 운영하고 계십니까? 장치 검색을 시작하려면 위치 권한 및 위치 서비스가 필요합니다. – Mackovich