pszklarska / beacon_broadcast

A Flutter plugin for turning your device into a beacon.
https://pub.dartlang.org/packages/beacon_broadcast/
MIT License
81 stars 34 forks source link

Eddystone broadcast issue #6

Closed ZainCheema closed 4 years ago

ZainCheema commented 4 years ago

Hello, I want to thank you for making this library. I am having an issue broadcasting my Android phone as an Eddystone beacon using the code below:

    BeaconBroadcast beaconBroadcast = BeaconBroadcast();

    beaconBroadcast
        .setUUID('39ED98FF-2900-441A-802F-9C398FC199D2')
        .setMajorId(1)
        .setMinorId(100)
        .setLayout(
            BeaconBroadcast.EDDYSTONE_UID_LAYOUT) //Android-only, optional
        .start();

I am getting the following error:

PlatformException (PlatformException(error, Beacon has 3 identifiers but format requires 2, null))

Any help regarding this would be much appreciated.

Thank you :)

pszklarska commented 4 years ago

Hi @ZainCheema! It means that for this beacon layout (Eddystone) you pass 3 indentifiers (UUID, majorId and minorId), but only 2 are required (probably only UUID and majorId). Try removing minorId:

BeaconBroadcast beaconBroadcast = BeaconBroadcast();

beaconBroadcast
    .setUUID('39ED98FF-2900-441A-802F-9C398FC199D2')
    .setMajorId(1)
    .setLayout(BeaconBroadcast.EDDYSTONE_UID_LAYOUT) //Android-only, optional
    .start();

If you're interested more in beacon layouts, you can read about it in the AlBeacon documentation: https://github.com/AltBeacon/android-beacon-library/blob/master/lib/src/main/java/org/altbeacon/beacon/BeaconParser.java#L169