8***@qq.com
8***@qq.com
  • 发布:2022-02-23 16:26
  • 更新:2022-02-24 11:59
  • 阅读:347

【报Bug】使用native.js 搜索蓝牙,btAdapter.ACTION_FOUND 值为null

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows 10 家庭中文版

HBuilderX类型: 正式

HBuilderX版本号: 3.3.11

手机系统: Android

手机系统版本号: Android 11

手机厂商: 小米

手机机型: 小米10至尊纪念版

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

let BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
let btAdapter = BluetoothAdapter.getDefaultAdapter();

console.log(btAdapter.ACTION_DISCOVERY_STARTED);
console.log(btAdapter.ACTION_DISCOVERY_FINISHED);
console.log(btAdapter.ACTION_FOUND);
console.log(btAdapter.ACTION_STATE_CHANGED);

操作步骤:

let BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
let btAdapter = BluetoothAdapter.getDefaultAdapter();

console.log(btAdapter.ACTION_DISCOVERY_STARTED);
console.log(btAdapter.ACTION_DISCOVERY_FINISHED);
console.log(btAdapter.ACTION_FOUND);
console.log(btAdapter.ACTION_STATE_CHANGED);

代码直接执行即可。

预期结果:

输入如下:
android.bluetooth.adapter.action.DISCOVERY_STARTED
android.bluetooth.adapter.action.DISCOVERY_FINISHED
android.bluetooth.adapter.action.ACTION_FOUND
android.bluetooth.adapter.action.STATE_CHANGED

实际结果:

android.bluetooth.adapter.action.DISCOVERY_STARTED
android.bluetooth.adapter.action.DISCOVERY_FINISHED
undefined
android.bluetooth.adapter.action.STATE_CHANGED

bug描述:

使用native.js 进行蓝牙操作,进行注册时,btAdapter.ACTION_FOUND值为null。manifast.json 文件中已进行相关权限设置。

2022-02-23 16:26 负责人:无 分享
已邀请:
FullStack

FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866

动态申请相关权限

该问题目前已经被锁定, 无法添加新回复