找不到Android Beacon:Google Beacon信息中心

时间:2018-10-09 05:47:30

标签: estimote google-beacon-platform

在我的android清单中,我已经这样放置了。

<meta-data
android:name="com.google.android.nearby.messages.API_KEY"
android:value="somethingnsomethingsomething" />

<!-- Required for Nearby Connections -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

在MainActivity中,我这样写。

private void buildGoogleApiClient() {
    if (mGoogleApiClient != null) {
        return;
    }
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Nearby.MESSAGES_API)
            .addConnectionCallbacks(this)
            .enableAutoManage(this, this)
            .build();
}


@Override
public void onConnected(@Nullable Bundle bundle) {
    Toast.makeText(getApplicationContext(), "onConnected", Toast.LENGTH_LONG).show();

    mMessageListener = new MessageListener() {
        @Override
        public void onFound(Message message) {
            Toast.makeText(getApplicationContext(), "Found message: " + new String(message.getContent()), Toast.LENGTH_LONG).show();
        }

        @Override
        public void onLost(Message message) {
            Toast.makeText(getApplicationContext(), "Found message: " + new String(message.getContent()), Toast.LENGTH_LONG).show();
        }
    };

    SubscribeOptions options = new SubscribeOptions.Builder()
            .setStrategy(Strategy.BLE_ONLY)
            .build();
    Nearby.getMessagesClient(this).subscribe(mMessageListener, options);
}

enter image description here

enter image description here

我正在使用estimote信标,我想我已成功添加到Google信标仪表板中。但是我找不到我的灯塔。有什么不对?

0 个答案:

没有答案