1.权限配置在module.json5文件中添加蓝牙相关权限:json{"module":{"requestPermissions":[{"name":"ohos.permission.ACCESSBLUETOOTH","reason":"需要使用蓝牙功能"}]}}2.导入蓝牙模块importbluetoothfrom'ohos.bluetooth';3.蓝牙状态检查与开启typescript用户申请蓝牙权限asyncrequestBlueToothPermission(){letgrantStatusawaitthis.reqPermissionsFromUser();for(leti0;i<grantStatus.length;i++){if(grantStatus[i]0){查看...
2025-08-08 13:33:28 2802浏览 0点赞 0回复 0收藏