3
電話がBluetoothでオンになっている場合、近くの発見可能なデバイスのIDのリストをアプリが読み取ることはできますか?もしそうなら、どの関数がそのようなリストを返しますか?近くのBluetoothデバイスのスキャン
ありがとうございます!
電話がBluetoothでオンになっている場合、近くの発見可能なデバイスのIDのリストをアプリが読み取ることはできますか?もしそうなら、どの関数がそのようなリストを返しますか?近くのBluetoothデバイスのスキャン
ありがとうございます!
は、ルックhere
// Create a BroadcastReceiver for ACTION_FOUND
private final BroadcastReceiver mReceiver = 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 address to an array adapter to show in a ListView
mArrayAdapter.add(device.getName() + "\n" + device.getAddress());
}
}
};
// Register the BroadcastReceiver
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver, filter); // Don't forget to unregister during onDestroy
を持っています