经过一番研究,我只能这样说:
摩托罗拉支持博通开发专有 API。它似乎非常有限,因为它声明仅支持现有配置文件。在这里查看。
三星未能提供有关其 BLE API 的任何信息,我可以验证这些信息是否存在,名为 samsung.bluetoothle。实际上,我从 Google Play 反编译了一些使用 SGSIII 的 BLE 功能的应用程序,发现了一些在 Android 的原生 BT API 中不存在的方法,它们的名称清楚地表明它们与 BLE 相关。我已经尝试通过 java 反射使用它们,目前正在研究开发库的可能性。但到目前为止,我进行的测试充其量只能得到不稳定的结果。三星的开发者论坛上也有一个帖子,如果你有兴趣,我建议在这里施加压力。
谷歌在这方面几乎没有表态。Galaxy Nexus中有一个关于这个问题的帖子,你应该给它加注,很多人都在抱怨。可以在此处找到最接近 Google 答案的内容。
[更新]
三星还修改了几个 Android 的类,更具体地说:
BluetoothAdapter
BluetoothDevice
[更新]
由于缺乏谷歌和三星的支持,我已经把这个问题搁置了一段时间,我将发布我到目前为止所学到的内容:
BluetoothAdapter
新方法:
public boolean android.bluetooth.BluetoothAdapter.leTestEnd()
public boolean android.bluetooth.BluetoothAdapter.setAvStreaming(boolean)
public boolean android.bluetooth.BluetoothAdapter.setScanLE(boolean)
public void android.bluetooth.BluetoothAdapter.setScoPathChange(int)
public boolean android.bluetooth.BluetoothAdapter.startLeDiscovery()
要使用它们,请执行以下操作:
BluetoothAdapter ba = new BluetoothAdapter();
Method starteLeDiscoveryMethod = null;
starteLeDiscoveryMethod = ba.class.getMethod("startLeDiscovery");
starteLeDiscoveryMethod.invoke(ba);
注意:这种方法的工作原理特别像常规startDiscovery()
方法,但至少对我来说,它在 5 次中发现了 2 个 BLE 设备。请记住,这仅适用于SGSIII。我还没有开始提取新方法,BluetoothDevice
但是当我这样做时,我会在这里发布它们。