5

AltBeacon http://altbeacon.github.io/android-beacon-library/index.htmlから Android ビーコン ライブラリをテストしています。

最初の ID (UUID) のみを設定し、id2 と id3 を null として設定する 1 つの「一般的な」領域を監視しています。

Region region = new Region(uuid, Identifier.parse(uuid), null, null);

問題なく didEnterRegion を受け取りましたが、質問があります。didEnterRegion では、Region をパラメーターとして受け取りますが、イベントを開始した具体的なビーコンを知ることはできますか? このイベント領域を起動するビーコンの id1、id2、id3 を知りたいのですが、可能ですか?

前もって感謝します

4

1 に答える 1

9

検出した特定のビーコンの識別子を知る必要がある場合は、レンジング API を使用してください。識別子を含む Beacon オブジェクトでコールバックを取得します。

beaconManager.setRangeNotifier(this);
beaconManager.startRangingBeaconsInRegion(region);
...

public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
        for (Beacon beacon: beacons) {
            Log.i(TAG, "Beacon detected with id1: "+beacon.getId1()+" id2:"+beacon.getId2()+" id3: "+beacon.getId3());     
        }
}
于 2014-08-22T10:47:20.827 に答える