Android 空的nearables列表estimote sdk

Android 空的nearables列表estimote sdk,android,bluetooth,estimote,beacon,Android,Bluetooth,Estimote,Beacon,我是使用android studio的estimote sdk新手。我在家里有一个灯塔,我想用它,用sdk获得一些流量。 在android 4.4.4 api19中使用小米 我遇到了一个奇怪的问题,我的手机发现了nearable,但实际的nearable列表是空的。谷歌搜索了一段时间,没有人有类似的问题。这可能是一件非常简单的事情,我现在还不明白。你知道吗?启用了蓝牙,只有一个信标离我很近,在hackathon上,由于信标过载,蓝牙崩溃 我的代码 package com.example.tom.

我是使用android studio的estimote sdk新手。我在家里有一个灯塔,我想用它,用sdk获得一些流量。 在android 4.4.4 api19中使用小米

我遇到了一个奇怪的问题,我的手机发现了nearable,但实际的nearable列表是空的。谷歌搜索了一段时间,没有人有类似的问题。这可能是一件非常简单的事情,我现在还不明白。你知道吗?启用了蓝牙,只有一个信标离我很近,在hackathon上,由于信标过载,蓝牙崩溃

我的代码

package com.example.tom.test;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import com.estimote.sdk.Beacon;
import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.Nearable;
import com.estimote.sdk.Region;

import java.util.List;


public class MainActivity extends ActionBarActivity {

    private BeaconManager beaconManager;
    private String scanId;
    private Nearable currentNearable;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        beaconManager = new BeaconManager(getApplicationContext());
        setContentView(R.layout.activity_main);
        beaconManager.setNearableListener(new BeaconManager.NearableListener() {
            @Override
            public void onNearablesDiscovered(List<Nearable> listOfNearables) {
                Log.d(null, "nearable discovered");
                Log.d(null, "size of list is " + String.valueOf(listOfNearables.size()));
                int maxPower = 0;
                if (!listOfNearables.isEmpty()) {
                    Log.d(null, "in");
                    maxPower = listOfNearables.get(0).power.powerInDbm;
                    currentNearable = listOfNearables.get(0);
                    for (Nearable nearable : listOfNearables) {
                        if (maxPower < nearable.power.powerInDbm) {
                            maxPower = nearable.power.powerInDbm;
                            currentNearable = nearable;
                        }
                    }
                    displayCurrentNearableInfo();
            }
        }
        });
    }

    @Override
    protected void onStart() {
        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            @Override
            public void onServiceReady() {
                scanId = beaconManager.startNearableDiscovery();
            }
        });
        super.onStart();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    protected void onDestroy() {
        beaconManager.disconnect();
        super.onDestroy();
    }
    @Override protected void onStop() {
        beaconManager.stopNearableDiscovery(scanId);
        super.onStop();
    }

    private void displayCurrentNearableInfo() {
        if(currentNearable != null){
        StringBuilder builder = new StringBuilder()
                .append("temperature: ").append(currentNearable.temperature).append("\n")
                .append("contents: ").append(currentNearable.describeContents())
                .append("power: " ).append(currentNearable.power.powerInDbm);
        TextView infoText = (TextView) findViewById(R.id.textView);
        infoText.setText(builder.toString());
        }
    }
}

您确定使用了正确的硬件吗?“Nearables”是更小的、像标签一样的信标。如果你使用的是岩石形状的,你需要通过测距来发现它们,而不是nearables discovery。我也使用了一个官方应用程序,但它也没有被发现,似乎电池没电了。你确定你使用了正确的硬件吗?“Nearables”是更小的、像标签一样的信标。如果你使用的是岩石形状的,你需要通过测距来发现它们,而不是nearables discovery。我也使用了一个官方应用程序,但它也没有被发现,好像电池没电了
11-11 10:18:19.750    5940-6027/com.example.tom.test D/BluetoothAdapter﹕ startLeScan(): null
11-11 10:18:19.750    5940-5952/com.example.tom.test D/BluetoothAdapter﹕ onClientRegistered() - status=0 clientIf=5
11-11 10:18:20.780    5940-6027/com.example.tom.test D/BluetoothAdapter﹕ stopLeScan()
11-11 10:18:20.820    5940-5940/com.example.tom.test D/﹕ nearable discovered
11-11 10:18:20.820    5940-5940/com.example.tom.test E/﹕ size of list is 0