0

I'm trying to make my android device as virtual iBeacon using alt beacon library, I'm able to make my device as iBeacon but it is not detecting in iOS(Core Location) or Android devices. Here is the code I'm using

Beacon beacon = new Beacon.Builder()
            .setId1("UUID")
            .setId2("101")
            .setId3("201")
            .setManufacturer(0x0075)
            .setTxPower(-59)
            .setDataFields(Arrays.asList(new Long[]{0l}))
            .build();

    BeaconParser beaconParser = new BeaconParser()
            .setBeaconLayout(BeaconParser.ALTBEACON_LAYOUT);
    BeaconTransmitter beaconTransmitter = new BeaconTransmitter(getApplicationContext(), beaconParser);
    beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {
        @Override
        public void onStartSuccess(AdvertiseSettings settingsInEffect) {
            super.onStartSuccess(settingsInEffect);
            Log.d(TAG, "Transmission started");

        }

        @Override
        public void onStartFailure(int errorCode) {
            super.onStartFailure(errorCode);
            Log.e(TAG, "Transmission failed with error code : " + errorCode);
        }
    });
Rupesh
  • 23
  • 3

1 Answers1

0

You can't detect the AltBeacon format (specified in the code shown with BeaconParser.ALTBEACON_LAYOUT) using CoreLocation on iOS. You can only detect iBeacon using that iOS API. To switch to iBeacon transmission, you must:

  • Use the proper iBeacon layout. This is proprietary so not part of the library for intellectual property reasons, but you can find the layout to use here: https://beaconlayout.wordpress.com/

  • Apple devices will only detect beacons using Apples bluetooth manufacturer code of 0x004c. You'll need to change the line that says .setManufacturer(0x0075) to use the value for Apple.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204