I am sending an image via bluetooth in android and want to fetch the MAC address of Device to which the image is being sent.
Please find below my code.
private void bluetoothadd(){
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
// Device does not support Bluetooth
Log.e("Bluetooth ","not found");
}
if (!mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivity(enableBtIntent);
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
// If there are paired devices
if (pairedDevices.size() > 0) {
// Loop through paired devices
for (BluetoothDevice device : pairedDevices) {
Log.e("Mac Addressess","are: "+mBluetoothAdapter.getRemoteDevice(device.getAddress()));
}
}
}
}
I am getting all paired device's MAC Address. I want the MAC Address of a device only to which data is being transmitted.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…