블루투스로 앱을 구현하고 있습니다. 이상한 문제가 있습니다. 내 블루투스를 스캔 할 때 사용 가능한 모든 기기를 보여주고 싶습니다.하지만 내 앱은 블루투스 만 발견하고 있습니다. 나는 구글을 검색 한하지만 어떤 solution.Any를 찾을 수 없습니다블루투스 검색으로 이상한 동작이 발생했습니다.
final BroadcastReceiver bReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
// When discovery finds a device
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the BluetoothDevice object from the Intent
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
// add the name and the MAC address of the object to the arrayAdapter
BTArrayAdapter.add(device.getName() + "\n" + device.getAddress());
BTArrayAdapter.notifyDataSetChanged();
}
}
};
public void find(View view) {
if (myBluetoothAdapter.isDiscovering()) {
// the button is pressed when it discovers, so cancel the discovery
myBluetoothAdapter.cancelDiscovery();
}
else {
BTArrayAdapter.clear();
myBluetoothAdapter.startDiscovery();
registerReceiver(bReceiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));
}
}
: 휴대 전화 또는 탭의 국지적 인 블루투스 내가 tutorial.Here 블루투스 장치를 찾을 수있는 코드 this을 사용하고 블루투스 기능을 구현 showing.To되지 않습니다 도움이 될 것입니다.
기기를 휴대 전화와 페어링 해 보셨습니까? – SeahawksRdaBest
Nopes. 페어링 된 장치를 표시하는 별도의 코드가 있습니다. – kgandroid
아니요. 안드로이드 기기에서 수신자/송신기 쪽 모두 설정으로 갔다가 페어링하려는 기기를 찾은 다음 확인을 완료 한 후 앱을 실행했습니다. 블루투스는 명백한 우려로 인해 보안 프로토콜에 까다 롭습니다. – SeahawksRdaBest