Android开发启蓝牙代码

jopen 6年前

    Intent i = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);           startActivityForResult(i, REQUEST_ENABLE_BT);  
    @Override            public void onActivityResult(int requestCode, int resultCode, Intent data) {                switch (requestCode) {                case REQUEST_ENABLE_BT:                    if (resultCode == Activity.RESULT_OK) {                        AppMsg.makeText(this, "蓝牙开启成功");                    }                    break;                }            }