Android examples for android.bluetooth:Bluetooth Address
get Bluetooth Address
import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.Intent; public class Main{ public static final int REQUEST_ENABLE_BT = 3; public static String getBluetoothAddress(boolean openOrNot, Activity activity) {/*from ww w . ja v a 2s . co m*/ String btMac = ""; BluetoothAdapter bAdapt = BluetoothAdapter.getDefaultAdapter(); if (bAdapt != null) { if (openOrNot && !bAdapt.isEnabled()) { Intent enBT = new Intent( BluetoothAdapter.ACTION_REQUEST_ENABLE); activity.startActivityForResult(enBT, REQUEST_ENABLE_BT); } btMac = bAdapt.getAddress(); } return btMac; } }