【发布时间】:2015-07-10 03:21:50
【问题描述】:
我开始使用 ibeacon 和 android。但是有一些问题需要你的帮助。在 blutoothGatCallback 上,我实现了 onConnectionStateChange 并调用了 discoverServices()。尽管如此,discoverServices() 返回 true 但没有执行任何回调,我希望 onServicesDiscovered 被调用,但不是。
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status,
int newState) {
Log.i(TAG, "onConnectionStateChange : " + status + " newState : "
+ newState);
if (newState == BluetoothProfile.STATE_CONNECTED) {
boolean isdiscover= mBluetoothGatt.discoverServices();
if(isdiscover){
mConnected = true;
}
}
}
状态为 133,newstate 已连接。状态是否会导致回调失败
【问题讨论】:
-
0x85 作为状态指示错误,因此您应该弄清楚为什么会得到它,然后它应该可以正常工作
-
请注意您使用的iBeacon的制造商和型号。并非所有 iBeacon 实现都支持 GATT 服务,因此您可能不应该能够连接。
标签: android bluetooth-lowenergy ibeacon-android