首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在android中检测不到Alt-beacon

在android中检测不到Alt-beacon
EN

Stack Overflow用户
提问于 2016-06-11 14:30:45
回答 1查看 580关注 0票数 0

我在我的android应用程序中使用Radius networks altbeacon库,但每当我从定位应用程序广播altbeacon时,我的应用程序都无法检测到altbeacon。

这是我的信标解析器:

代码语言:javascript
复制
 mBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25")); 

这是我的ANDROID STUDIO LOGCAT:

代码语言:javascript
复制
06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome D/BeaconParser:Ignoring pdu type 01
06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome D/BeaconParser: Processing pdu type FF: 02011a1aff4c0002152f234454cf6d4a0fadf2f4911ba9ffa600000000c50000000000000000000000000000000000000000000000000000000000000000 with startIndex: 5, endIndex: 29
06-11 11:43:45.239 15797-16636/optimus.com.optimusiothome D/BeaconParser: This is not a matching Beacon advertisement. (Was expecting be ac.  The bytes I see are: 02011a1aff4c0002152f234454cf6d4a0fadf2f4911ba9ffa600000000c50000000000000000000000000000000000000000000000000000000000000000

每当我在我的iphone中从本地应用程序传输altbeacon时,下面的代码在logcat中打印了很多次,但主要的问题是,didRangeBeaconsInRegion()函数永远不会被调用,并且我在函数中的代码也不会被执行,即我的安卓应用程序无法检测altbeacon (从myiphone中的定位应用程序传输):

代码语言:javascript
复制
06-11 11:44:38.669 18053-18072/optimus.com.optimusiothome D/ScanRecord: parseFromBytes
06-11 11:44:38.669 18053-18072/optimus.com.optimusiothome D/ScanRecord: first manudata for manu ID
06-11 11:44:38.669 18053-18072/optimus.com.optimusiothome D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=69:86:DE:DD:64:1D, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, 47, 35, 68, 84, -49, 109, 74, 15, -83, -14, -12, -111, 27, -87, -1, -90, 0, 0, 0, 0, -59]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-55, mTimestampNanos=97773873478375}

我在android gradle中使用了以下依赖项:

代码语言:javascript
复制
compile 'org.altbeacon:android-beacon-library:2.7'

更多的代码:

代码语言:javascript
复制
@Override
public void onBeaconServiceConnect() {
       Region region = new Region("all-beacon-region",null,null,null);
    // this tells the library that we want to know about any beacon we see.
    try {
        mBeaconManager.startMonitoringBeaconsInRegion(region);
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    //The last line sets the rangeNotifier to this class,
    //so our the same RangingActivity class will get callbacks each time a beacon is seen.
    mBeaconManager.setRangeNotifier(this);
}

@Override
public void didRangeBeaconsInRegion(Collection<Beacon> collection, Region region) {
    for(Beacon beacon : collection)
    {
        Log.d(TAG, "Beacon detected with id1: " + beacon.getId1() + " id2:" + beacon.getId2() + " id3: " + beacon.getId3() + " distance: " + beacon.getDistance());
        ((TextView)beacon_transmit_detect.this.findViewById(R.id.message)).setText("Beacon detected with id1: " + beacon.getId1() + " id2:" + beacon.getId2() + " id3: " + beacon.getId3() + " distance: " + beacon.getDistance());

    }
}



@Override
    protected void onResume()
    {
        super.onResume();
        mBeaconManager=BeaconManager.getInstanceForApplication(this.getApplicationContext());
        mBeaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"));
 mBeaconManager.bind(this);
    }

我的主类实现了BeaconConsumer,RangeNotifier。

EN

回答 1

Stack Overflow用户

发布于 2016-06-20 23:56:48

这是一个主要的信标布局列表,检查您的布局是否正确。

ALTBEACON "m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25“

EDDYSTONE TLM "x,s:0-1=feaa,m:2-2=20,d:3-3,d:4-5,d:6-7,d:8-11,d:12-15“

EDDYSTONE UID "s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19“

EDDYSTONE URL "s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-20v“

IBEACON "m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24“

这里有一个参考列表。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37760708

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档