Managing Bluetooth Properties and State
BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
String toastText;
if (bluetooth.isEnabled()) {
String address = bluetooth.getAddress();
String name = bluetooth.getName();
toastText = name + " : " + address;
}
else
toastText = "Bluetooth is not enabled";
Toast.makeText(this, toastText, Toast.LENGTH_LONG).show();
If you also have the BLUETOOTH_ADMIN permission you can change the friendly name of the Bluetooth
Adapter using the setName method:
bluetooth.setName("Anonimous");
Comments
Post a Comment