AltBeacon / android-beacon-library

Allows Android apps to interact with BLE beacons
Apache License 2.0
2.84k stars 836 forks source link

Problems with Eddystone-URL transmitting and Chrome Physical Web #402

Closed radzio closed 8 years ago

radzio commented 8 years ago

I was trying to transmit Eddystone-URL using this code:

        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");
        }

I am able to to see to transmitted beacon on my second device using this app: https://play.google.com/store/apps/details?id=com.uriio&hl=pl

But this beacon is not visible in Chrome Physical Web on my second device. When I've used BeaconToy app to transmit Eddystone-URL beacon my second device has found this beacon both in Chrome Physical Web and BeaconToy.

Do I have something in my transmitting code or is it a bug in altbeacon?

davidgyoung commented 8 years ago

See #401. A release candidate with this fix should be available this week.

radzio commented 8 years ago

@davidgyoung thanks for response!

davidgyoung commented 8 years ago

Fixed via #401

davidgyoung commented 8 years ago

Released in 2.9