18 android bluetooth emulation android-emulator bluetooth-lowenergy
我研究了蓝牙低功耗.
但我没有支持BLE设备进行测试.
因此,我想问:
Android模拟器是否支持BLE功能进行测试?
我在Android Emulator 4.3(x86)和Android Emulator 4.4(ARM)上尝试使用以下代码:
// Use this check to determine whether BLE is supported on the device. Then
// you can selectively disable BLE-related features.
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
finish();
}
Run Code Online (Sandbox Code Playgroud)
它总是显示"ble_not_supported".
另一个问题是
哪个其他模拟器或工具支持Android的BLE?
我真的想在模拟器上测试BLE功能.
gab*_*ous 20
看来你可以在VirtualBox中使用Android并使用支持蓝牙LE的PC加密狗(在亚马逊上花费约18美元).这是Chris Larson的教程(复制到这里以保持在线):
Android模拟器非常适合开发BluetoothLE应用程序.诀窍是让Android模拟器识别BluetoothLE适配器.
你需要什么:
- 来自android-x86.org的Androidx86 iso我使用了4.4版本的候选版本
- 虚拟机软件:我使用的是Oracle VirtualBox
- 蓝牙USB USB适配器:我使用的是Cirago蓝牙4.0 USB迷你适配器(BTA8000)(附属链接)或Cirago蓝牙4.0 USB迷你适配器(BTA8000)(非附属链接)
- 安装Android SDK进行调试
- 安装VirtualBox
- 下载Androidx86
- 打开VirtualBox并创建一台新机器.将类型设置为linux/other(32bit)
- 将虚拟机的内存和硬盘空间设置为您需要的任何内容(但至少是Android的最低规格).
- 当询问操作系统映像时,请选择从Androidx86.org下载的Androidx86映像
- 虚拟机启动时,选择安装Android.
- 安装完成后,关闭Android虚拟机并卸载iso映像
- 插入蓝牙USB适配器并将其添加到Android虚拟机的设置中
- 启动Android虚拟机并通过启动屏幕配置Android以供使用
- 在Android VM中转到设置并启用BluetoothLE(如果此操作失败,请重新启动VM并尝试再次启用)
以下是一些描述或多或少相同方法的其他链接,以及您可能感兴趣的一些其他工具:
如果你想让这个问题得到谷歌的解决,你可以通过这个帖子加注它以使其更加明显(有足够的票数,谷歌将在几年内处理它,就像他们对音频问题所做的那样......):
https://code.google.com/p/android/issues/detail?id=56608
| 归档时间: |
|
| 查看次数: |
24142 次 |
| 最近记录: |