如何找出如果Android设备支持蓝牙低耗能 [英] How to find out if Android device supports Bluetooth Low Energy

查看:189
本文介绍了如何找出如果Android设备支持蓝牙低耗能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎的Nexus 7的第一代不支持蓝牙低耗能,至少在我遵循的教程完全相同的步骤

It seems Nexus 7 first generation isn't support Bluetooth Low Energy, at least when I follow exactly steps from tutorial

<一个href="http://developer.android.com/guide/topics/connectivity/bluetooth-le.html">http://developer.android.com/guide/topics/connectivity/bluetooth-le.html

我有以下的code程序处理:

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 device support low energy standard?

更新:我使用的是安卓4.3

UPDATE: I'm using android 4.3

推荐答案

您code是真的好, 但你完全添加以下code?

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"/>

重要code是:

The important code is :

<uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/>

由于我们需要确保应用程序能够成功地运行,

Because we need to make sure the application can run succesfully,

不过,如果你想使你的应用程序提供给不支持BLE的设备,你仍然应该包括该元素在你的应用程序的清单,但需要设置=FALSE

However, if you want to make your app available to devices that don't support BLE, you should still include this element in your app's manifest, but set required="false"

这code对我的作品。

That code works for me.

编辑: 我发现了一些对你有好处了解 哪些设备与BLE功能不兼容

I found something good for you about which devices be compatible with BLE feature

这篇关于如何找出如果Android设备支持蓝牙低耗能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆