android 打开蓝牙:如何在Android设备上开启蓝牙

在 .xml 中添加权限:

在 .xml 中添加权限:

1. 在 AndroidManifest.xml 中添加权限:

2. 在 Activity 中打开蓝牙:

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

if (mBluetoothAdapter == null) {

// Device doesn't support Bluetooth

}

if (!mBluetoothAdapter.isEnabled()) {

Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);

startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);

}

本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处

(981)
tp钱包ios怎么下载:如何下载TP钱包iOS版?
上一篇
ios验证应用无法验证解决方案探索
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(2条)