Generate Bluetooth id - Android Bluetooth

Android examples for Bluetooth:Bluetooth Address

Description

Generate Bluetooth id

Demo Code


//package com.java2s;

import android.bluetooth.BluetoothAdapter;

public class Main {
    public static String openUdid = null;

    public static void generateBlueToothId() {
        try {/*from   www.j  ava  2 s . c o  m*/
            BluetoothAdapter m_BluetoothAdapter = null;
            m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
            String m_szBTMAC = m_BluetoothAdapter.getAddress();
            if (null != m_szBTMAC) {
                openUdid = "BT:" + m_szBTMAC;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related Tutorials