我想在android中看到信號與estimote sdk,但沒有運氣!我可以看到所有的estimote信標,但與所有其他信標無法正常工作( fobo信標等)我在區域構造函數內使用uuid作爲fobo信標,我可以在logcat中看到藍牙可以看到這些設備,但估計sdk沒有收集它作爲信標!任何想法爲什麼會發生這種情況?我米張貼下面的代碼:Android Estimote 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或if我沒有使用uuid(然後它爲所有uuids掃描)! – sfig
你肯定是FOBO UUID嗎?您可以使用其他應用程序成功檢測到iBeacon嗎? – davidgyoung