【发布时间】:2014-05-29 23:18:27
【问题描述】:
我试图在 android 中查看带有 estimote sdk 的信标,但没有运气!我可以看到所有的 estimote 信标,但所有其他信标都不起作用(fobo 信标等)我正在使用 uuid 作为 fobo 信标在 Region 构造函数中,我可以在 logcat 中看到蓝牙可以看到设备,但 estimode sdk 没有将其收集为信标!知道为什么会这样吗?我在下面发布代码:
private static final String FOBO_PROXIMITY_UUID = "00158800-587d-2206-d52b-fb6d6e2f0001";
private static final Region FOBOBEACONS = new Region("rid", FOBO_PROXIMITY_UUID , null, null);
public void BeaconManager(){
beaconManager = new com.estimote.sdk.BeaconManager(this);
beaconManager.setBackgroundScanPeriod(5000, 30000);
beaconManager.setForegroundScanPeriod(7000, 5000);
beaconManager.setRangingListener(new com.estimote.sdk.BeaconManager.RangingListener() {
@Override
public void onBeaconsDiscovered(final Region arg0, final List<Beacon> arg1) {
// TODO Auto-generated method stub
runOnUiThread(new Runnable() {
@Override
public void run() {
// Note that beacons reported here are already sorted by estimated
// distance between device and beacon.
int test=0;
if(arg1.size()<=0){
Toast.makeText(MainActivity.this, "No beacon found",
Toast.LENGTH_SHORT).show();
}else{
for (int i = 0; i < arg1.size(); i++) {
String beac=arg1.get(i).getProximityUUID();
Toast.makeText(MainActivity.this, "I found a beacon with UUID; "+beac,
Toast.LENGTH_SHORT).show();
}
}
// adapter.replaceWith(beacons);
}
});
}
});
connectToService();
}
private void connectToService() {
beaconManager.connect(new com.estimote.sdk.BeaconManager.ServiceReadyCallback() {
@Override
public void onServiceReady() {
try {
com.estimote.sdk.utils.L.enableDebugLogging(true);
beaconManager.startRanging(FOBOBEACONS);
} catch (RemoteException e) {
Toast.makeText(MainActivity.this, "Cannot start ranging, something terrible happened",
Toast.LENGTH_LONG).show();
}
}
});
}
【问题讨论】:
-
我不一定期望它会起作用。但是为什么要将 ESTIMOTE_PROXIMITY_UUID 传递给区域构造函数?如果您打算查找具有非估计 UUID 的信标,我希望您需要为要查看的 UUID 构建一个区域。
-
对不起,这是我在编写我更正的代码时的错误,但问题不在于我的代码中我使用的是 fobo uuid 并且无法正常工作!此外,如果此代码适用于 estimote 信标我使用 estimote uuid,或者如果我不使用 uuid(那么它假设扫描所有 uuid)!
-
您确定是 FOBO UUID 吗?能否使用其他应用成功检测 iBeacon?
-
是的,从无线电网络中定位 ibeacon 我可以看到检测到信标,正如我在 logcat 中看到的那样:“设备 xx:xx:xx:xx:xx (MAC 地址) 是不是 estimode 灯塔”。所以可能 estimode sdk 不支持其他信标!
标签: android android-bluetooth ibeacon-android estimote