问题描述
似乎 Nexus 7 第一代不支持低功耗蓝牙,至少当我完全按照教程中的步骤操作时
It seems Nexus 7 first generation doesn't support Bluetooth Low Energy, at least when I follow exactly steps from tutorial
http://developer.android.com/guide/topics/connectivity/bluetooth-le.html
我确实在以下代码上完成了应用程序:
I do have app finish on following code:
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
finish();
}
我确实检查过,启用了蓝牙.
Sure I checked, that Bluetooth enabled.
那么问题来了,如何确定设备是否支持蓝牙低功耗标准?
So the question is, how to find out for sure, if the device supports Bluetooth Low Energy standard?
更新:我使用的是 android 4.3
UPDATE: I'm using android 4.3
推荐答案
你的代码真的很好,但是您是否准确添加了以下代码?
Your code is really good,But do you add the following code exactly?
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
重要的代码是:
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>
因为我们需要确保应用程序能够成功运行,
Because we need to make sure the application can run succesfully,
但是,如果您想让您的应用程序可用于不支持 BLE 的设备,您仍应在应用程序的清单中包含此元素,但设置 required="false"
该代码对我有用.
我发现了一些关于哪些设备与 BLE 功能兼容
I found something good for you about which devices be compatible with BLE feature
这篇关于如何确定 Android 设备是否支持低功耗蓝牙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!