【问题标题】:How to change an estimote beacon's UUID through estimote android sdk?如何通过 estimote android sdk 更改 estimote 信标的 UUID?
【发布时间】:2017-02-02 19:22:10
【问题描述】:

下午好。我正在开发一个 android 应用程序,我正在尝试将一个 estimote 信标与该应用程序集成。问题是我希望能够发现特定设备更改设备的 UUID、次要、主要。

要发现和确定我正在使用的信标:

    beaconManager.startRanging(region);

            beaconManager.setRangingListener(new BeaconManager.RangingListener() {
                @Override
                public void onBeaconsDiscovered(Region region, List<Beacon> list) {

                    if (!list.isEmpty()) {

                        for(Beacon b : list){

                            if (b.getMacAddress().equals(macaddress)){

 %%Now that i have the Beacon b I would like to change it's UUID, major and minor.
                            }
                        }
                    }
                }
            });

有人可以帮助我吗?我知道为了更改 UUID,我需要连接到 estimote 云,但我不太明白如何(他们网站上的示例使用了已弃用的 BeaconConnection)。

【问题讨论】:

  • 无法更改 iBeacon 的 UUID。
  • @AjayShrestha 是的,你可以估计

标签: android beacon estimote


【解决方案1】:

我使用这种方法,我在 Estimote andriod sdk 上找到,它已被 Estimote 弃用,但通过在 android studio 中使用正确的 api 设置可以正常工作。

我还没有找到替代解决方案,但如果我找到了,我会更新我的答案。

private void editBeacon(final Beacon beacon, UUID newUuid, int newMinor, int newMajor) {
    connection = new BeaconConnection(this, beacon, new BeaconConnection.ConnectionCallback() {
        @Override
        public void onAuthorized(BeaconInfo beaconInfo) {

        }

        @Override
        public void onConnected(BeaconInfo beaconInfo) {
            Log.d(TAG, "Authenticated to beacon. Info: " + beaconInfo);
            Log.d(TAG, "Advertising internal: " + connection.advertisingIntervalMillis().get());
            Log.d(TAG, "Broadcasting transmitPower: " + connection.broadcastingPower().get());
        }

        @Override
        public void onAuthenticationError(EstimoteDeviceException exception) {
            Log.d(TAG, "Authentication Error: " + exception);
        }

        @Override
        public void onDisconnected() {
            Log.d(TAG, "Disconnected");
        }
    });

    connection.authenticate();

    // Interact with beacon.

    // You can update beacon's properties in following way:
    connection.edit()
            .set(connection.proximityUuid(), newUuid)
            .set(connection.major(), newMajor)
            .set(connection.minor(), newMinor)
            .commit(new BeaconConnection.WriteCallback() {
                @Override
                public void onSuccess() {
                }

                @Override
                public void onError(EstimoteDeviceException exception) {
                }
            });

    // Do not forget to close connection.
    connection.close();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-18
    相关资源
    最近更新 更多