get bluetooth adapter MAC address - Android Bluetooth

Android examples for Bluetooth:Bluetooth Address

Description

get bluetooth adapter MAC address

Demo Code


import android.bluetooth.BluetoothAdapter;
import android.util.Log;

public class Main{
    /**//from   w ww  .ja v  a  2  s . com
     * get bluetooth adapter MAC address
     *
     * @return MAC address String
     */
    public static String getBluetoothMacAddress() {
        BluetoothAdapter mBluetoothAdapter = BluetoothAdapter
                .getDefaultAdapter();

        // if device does not support Bluetooth
        if (mBluetoothAdapter == null) {
           return null;
        }

        return mBluetoothAdapter.getAddress();
    }
}

Related Tutorials