Search code examples
ibeacon-androideddystone

Why is there a limit for major of 65535 in the library when using eddystone UID format? Could I redefine this limit?


I need to set a value of instance id greater than 65535 for transmitting like a beacon but Android Beacon Library apparently doesnt allow that.

Code works fine with a value of major less than 65535.

uuid="87657753868957865aaa"
major = "1000"; // when this number is bigger than 65535 doesn t work
beacon = new Beacon.Builder()
                .setId1(uuid)
                .setId2(major)
                .setManufacturer(0x00e0)
                .setTxPower(-59)
                .build();
beaconParser = new BeaconParser()
         .setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14- 
19");

Could I use a major bigger than 65535?


Solution

  • You can set a value greater than 65535, but it must be expressed in hex format. Try, "0x10000" (65536 decimal) or "0xffffffffffff" (the max value allows by an Eddystone Instance ID).

    See the "Allowed formats" for parsing a string into an Identifier in the Javaocs here: https://altbeacon.github.io/android-beacon-library/javadoc/org/altbeacon/beacon/Identifier.html