3

我们有一个基于 iBeacon 的生态系统,并希望通过 Android 广告对其进行扩展。我们使用基于此博客文章的 AltBeacon BeaconTransmitter 类:http: //developer.radiusnetworks.com/2014/11/18/beacon-transmission-with-android-5.html与此线程中提到的信标布局:这是使用 AltBeacon 的 Android 信标库检测 iBeacons 的正确布局?

我们使用 Nexus 9 平板电脑做广告,我们的其他 Android 设备可以看到广告信标,但 iOS 设备不能。

我们像这样创建信标:

mBeaconTransmitter = new BeaconTransmitter(this, new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
            // Transmit a beacon with Identifiers 2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 1 2
            Beacon beacon = new Beacon.Builder()
                    .setId1("our uuid")
                    .setId2("a major id")
                    .setId3("a minor id")
                    .setManufacturer(0x0000)
                    .setTxPower(-59)
                    .setDataFields(Arrays.asList(new Long[] {0l}))
                    .build();

缺少的部分可能是什么?在 CL 的 didRangeBeacons 方法中,我们看不到这个信标。

4

1 回答 1

3

The Android Beacon Library's new BeaconTransmitter class requires that the new BeaconParser.setBeaconLayout() expression be exactly right for the beacon type you wish to transmit.

Two things about the code look suspicious:

  1. The code calls setDataFields() on the beacon even though no data fields are defined in the beacon layout expression (with a d: prefix). This should probably cause an exception, but if it does not, it could be screwing up the transmission. I would remove this.

  2. I am not sure if a manufacturer code of 0x0000 is valid. If (1) does not solve the problem, try different manufacturer codes to find one that works with iOS.

Just to verify there is no problem with the Nexus 9 hardware, try running the free QuickBeacon app in the Google Play store. It uses the exact same APIs to transmit, so if it works you should be able to make your code work, too.

于 2014-12-09T13:13:57.887 回答