AltBeacon - Eddystone-URL传输和Chrome物理网的问题

时间:2016-07-20 20:10:07

标签: android altbeacon eddystone eddystone-url

我试图使用以下代码传输Eddystone-URL:

try
{
    byte[] urlBytes = UrlBeaconUrlCompressor.compress("http://google.com");
    Identifier encodedUrlIdentifier = Identifier.fromBytes(urlBytes, 0, urlBytes.length, false);
    ArrayList<Identifier> identifiers = new ArrayList<Identifier>();
    identifiers.add(encodedUrlIdentifier);
    Beacon beacon = new Beacon.Builder()
            .setIdentifiers(identifiers)
            .setManufacturer(0x0188)
            .setTxPower(-7)
            .build();
    BeaconParser beaconParser = new BeaconParser().setBeaconLayout(BeaconParser.EDDYSTONE_URL_LAYOUT);
    BeaconTransmitter beaconTransmitter = new BeaconTransmitter(getApplicationContext(), beaconParser);
    beaconTransmitter.setAdvertiseTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH);
    beaconTransmitter.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY);
    beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback()
    {
        @Override
        public void onStartFailure(int errorCode)
        {
            Log.e(TAG, "Advertisement start failed with code: " + errorCode);
        }

        @Override
        public void onStartSuccess(AdvertiseSettings settingsInEffect)
        {
            Log.i(TAG, "Advertisement start succeeded.");
        }
    });
}
catch (MalformedURLException e)
{
    Log.d(TAG, "That URL cannot be parsed");
}

我可以使用此应用在我的第二台设备上看到传输的信标:https://play.google.com/store/apps/details?id=com.uriio&hl=pl

但是我的第二台设备上的Chrome物理网络中无法看到此信标。当我使用BeaconToy应用程序传输Eddystone-URL信标时,我的第二台设备在Chrome物理网和BeaconToy中都找到了这个信标。

我的传输代码中是否有某些内容,或者它是altbeacon中的错误?

1 个答案:

答案 0 :(得分:1)

这是Android Beacon Library 2.8.1中新发现的错误。已提出修复方案,并计划在本周末发布。有关详细信息,请参见此处:

https://github.com/AltBeacon/android-beacon-library/pull/401