android的bluetooth

来源:互联网 发布:室内设计用哪些软件 编辑:程序博客网 时间:2024/05/16 01:18

打开蓝牙

public void turnOnBT(){

BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();

if(!btAdapter.isEnabled){

Intent i = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);

startActivityForResult(i,CODE_TURN_ON_BT);

}else{

startActivityForResult(new Intent(this,DeviceListActivity.class),CODE_DEVICE_LIST);

}

0 0
原创粉丝点击