Android examples for android.bluetooth:Bluetooth Address
get Bluetooth Mac Address
import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.Intent; import android.text.TextUtils; import java.util.Locale; public class Main{ public static String getBluetoothMacAddress() { BluetoothAdapter bluetoothDefaultAdapter = BluetoothAdapter .getDefaultAdapter();// w ww. j a va 2 s.co m if ((bluetoothDefaultAdapter != null) && (bluetoothDefaultAdapter.isEnabled())) { String bluetoothMacAddress = BluetoothAdapter .getDefaultAdapter().getAddress(); return TextUtils.isEmpty(bluetoothMacAddress) ? null : bluetoothMacAddress.replace(":", "").toLowerCase( Locale.US); } return null; } }