0

I am having trouble emitting an iBeacon from an android device, the Nexus 6. I have no problem detecting the beacon signal that I am emitting from my android devices or an iTouch, but I cannot locate the signal from an iPhone. I am using the altbeacon library and using the BeaconTransmitter class. I put in a separate thread.

    new Thread(new Runnable() {
        @Override
        public void run() {
            mBeaconTransmitter = new BeaconTransmitter(CredentialActivity.this, new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
            beacon = new Beacon.Builder()
                    .setId1("BA39A880-799C-46FA-86AB-A4AC51927BAA")
                    .setId2("1")
                    .setId3(String.valueOf(selectedBouncer))
                    .setManufacturer(0x0000) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
                    .setTxPower(-59)
                    .setDataFields(Arrays.asList(new Long[]{0l}))
                    .build();
                mBeaconTransmitter.startAdvertising(beacon);
        }
    }
    ).start();
}

1 Answers1

3

A few points:

  • The code is are calling .setDatafields(), but the format has no data fields ("d:" prefix) defined. The call to .setDatafields() should be removed.

  • The manufacturer code should match the Bluetooth SIG manufacturer code of the company that owns the beacon type you are emulating. You can see the full list of two byte codes here.

Also, you may want to make sure one of the following apps in the Google Play Store work on your device so that you can make sure you don't have some hardware setup issue. These apps are known to work to transmit an iBeacon advertisement on the Nexus 6, and they use the same library under the hood:

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Added what you put in and it worked like a charm! We're going to be using this app on a commercial basis without any prior to knowledge which devices will be reading in this beacon. If I set the manufacturing ID to apples, will it work for all devices still? I am seeing it work with my samsung s4. If so, can I create extra instances of BeaconTransmitter to take care of this problem? – Hyunwoo Park Jan 15 '15 at 16:37
  • Typically, beacon manufacturers will standardize on a single company code for a beacon format, so I don't think you will have a problem, and I do not think you need to create additional BeaconTransmitter instances. If you want to transmit two different beacon formats simultaneously, say AltBeacon and iBeacon, then yes you might want to do this. – davidgyoung Jan 15 '15 at 16:59