如何以编程方式打开蓝牙

时间:2012-10-19 09:50:13

标签: android bluetooth

  

可能重复:
  How to enable/disable bluetooth programmatically in android

您好我正在开发一个以编程方式打开蓝牙的应用程序,请您提前告诉我如何逐步完成该操作

1 个答案:

答案 0 :(得分:3)

此代码适用于我。你可以试试这个

  BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();    
        if (!mBluetoothAdapter.isEnabled()) {
           //Play with bluetooth
        }else{ 
            mBluetoothAdapter.disable(); 
        }