无法在后台模式下检测AltBeacon

时间:2016-07-14 13:10:54

标签: android ibeacon ibeacon-android altbeacon beacon

我试图用Android Beacon Library检测信标。在前景模式的情况下它工作得很好,但在后台它不起作用。我的应用程序实现了BootstrapNotifier。我在onCreate()

中有以下几行
org.altbeacon.beacon.Region region = new org.altbeacon.beacon.Region("Region", null, null, null);
regionBootstrap = new RegionBootstrap(this, region);

didEnterRegion():

@Override
public void didEnterRegion(org.altbeacon.beacon.Region region) {
    Log.d("beacon", "Got a didEnterRegion call");

    Intent intent = new Intent(this, MainDashboardActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    this.startActivity(intent);
}

我试图读取日志而没有信标它看起来像:

07-14 15:16:16.848 13592-13592/com.mobium1182.app D/BluetoothAdapter: startLeScan(): null
07-14 15:16:16.851 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
07-14 15:16:16.965 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-70, mTimestampNanos=9110127109925}
07-14 15:16:17.144 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-76, mTimestampNanos=9110307089196}
07-14 15:16:17.326 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-76, mTimestampNanos=9110488244613}
07-14 15:16:17.694 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-76, mTimestampNanos=9110857037061}
07-14 15:16:18.607 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-94, mTimestampNanos=9111769944352}
07-14 15:16:18.979 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-70, mTimestampNanos=9112141879248}
07-14 15:16:19.160 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-76, mTimestampNanos=9112322519560}
07-14 15:16:19.346 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-78, mTimestampNanos=9112508265914}
07-14 15:16:19.529 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-94, mTimestampNanos=9112691427893}
07-14 15:16:19.894 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-75, mTimestampNanos=9113056789456}
07-14 15:16:21.004 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9114166633518}
07-14 15:16:21.182 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9114344215653}
07-14 15:16:21.545 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-77, mTimestampNanos=9114707169507}
07-14 15:16:21.726 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-81, mTimestampNanos=9114888275496}
07-14 15:16:21.911 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9115074133986}
07-14 15:16:22.104 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9115266620444}
07-14 15:16:22.470 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-79, mTimestampNanos=9115631781798}
07-14 15:16:22.651 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9115813068100}
07-14 15:16:23.014 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9116176225965}
07-14 15:16:23.942 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-80, mTimestampNanos=9117102104350}
07-14 15:16:24.669 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-72, mTimestampNanos=9117831349558}
07-14 15:16:24.850 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9118012431433}
07-14 15:16:25.215 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9118377511381}
07-14 15:16:25.397 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-86, mTimestampNanos=9118559377943}
07-14 15:16:25.583 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-67, mTimestampNanos=9118745223828}
07-14 15:16:26.131 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-87, mTimestampNanos=9119293121276}
07-14 15:16:26.314 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9119476461536}
07-14 15:16:26.870 13592-13592/com.mobium1182.app D/BluetoothAdapter: stopLeScan()

启用信标后,它就是

07-14 15:16:36.850 13592-13592/com.mobium1182.app D/BluetoothAdapter: startLeScan(): null
07-14 15:16:36.853 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
07-14 15:16:36.931 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-80, mTimestampNanos=9130093610543}
07-14 15:16:37.115 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-80, mTimestampNanos=9130277744501}
07-14 15:16:37.300 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-77, mTimestampNanos=9130462197001}
07-14 15:16:37.486 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-90, mTimestampNanos=9130648694084}
07-14 15:16:37.631 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=C3:77:13:2D:C1:64, mScanRecord=ScanRecord [mAdvertiseFlags=4, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -71, 64, 127, 48, -11, -8, 70, 110, -81, -7, 37, 85, 107, 87, -2, 109, 18, 52, 26, 84, -61]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-42, mTimestampNanos=9130793836324}
07-14 15:16:37.671 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-80, mTimestampNanos=9130833928407}
07-14 15:16:38.221 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-77, mTimestampNanos=9131381350855}
07-14 15:16:38.400 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-72, mTimestampNanos=9131563194344}
07-14 15:16:38.581 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-84, mTimestampNanos=9131744007105}
07-14 15:16:38.637 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=C3:77:13:2D:C1:64, mScanRecord=ScanRecord [mAdvertiseFlags=4, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -71, 64, 127, 48, -11, -8, 70, 110, -81, -7, 37, 85, 107, 87, -2, 109, 18, 52, 26, 84, -61]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-44, mTimestampNanos=9131799923198}
07-14 15:16:38.766 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-73, mTimestampNanos=9131928391948}
07-14 15:16:39.502 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-78, mTimestampNanos=9132664990021}
07-14 15:16:39.686 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-79, mTimestampNanos=9132848987104}
07-14 15:16:40.600 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-78, mTimestampNanos=9133762614812}
07-14 15:16:40.651 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=C3:77:13:2D:C1:64, mScanRecord=ScanRecord [mAdvertiseFlags=4, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -71, 64, 127, 48, -11, -8, 70, 110, -81, -7, 37, 85, 107, 87, -2, 109, 18, 52, 26, 84, -61]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-45, mTimestampNanos=9133814144396}
07-14 15:16:40.782 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-79, mTimestampNanos=9133944237885}
07-14 15:16:40.974 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-80, mTimestampNanos=9134136730854}
07-14 15:16:41.332 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9134494395020}
07-14 15:16:41.524 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9134682050593}
07-14 15:16:41.662 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=C3:77:13:2D:C1:64, mScanRecord=ScanRecord [mAdvertiseFlags=4, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -71, 64, 127, 48, -11, -8, 70, 110, -81, -7, 37, 85, 107, 87, -2, 109, 18, 52, 26, 84, -61]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-45, mTimestampNanos=9134822143301}
07-14 15:16:41.696 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-81, mTimestampNanos=9134858870749}
07-14 15:16:42.250 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-77, mTimestampNanos=9135411394030}
07-14 15:16:42.431 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-76, mTimestampNanos=9135593807832}
07-14 15:16:42.616 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9135778420332}
07-14 15:16:42.797 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-68, mTimestampNanos=9135959398822}
07-14 15:16:43.530 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-69, mTimestampNanos=9136692165853}
07-14 15:16:43.668 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=C3:77:13:2D:C1:64, mScanRecord=ScanRecord [mAdvertiseFlags=4, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -71, 64, 127, 48, -11, -8, 70, 110, -81, -7, 37, 85, 107, 87, -2, 109, 18, 52, 26, 84, -61]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-46, mTimestampNanos=9136829981686}
07-14 15:16:43.714 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-82, mTimestampNanos=9136876451113}
07-14 15:16:43.894 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-80, mTimestampNanos=9137056543301}
07-14 15:16:44.447 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-82, mTimestampNanos=9137610074186}
07-14 15:16:44.631 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-78, mTimestampNanos=9137794141842}
07-14 15:16:44.675 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=C3:77:13:2D:C1:64, mScanRecord=ScanRecord [mAdvertiseFlags=4, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -71, 64, 127, 48, -11, -8, 70, 110, -81, -7, 37, 85, 107, 87, -2, 109, 18, 52, 26, 84, -61]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-46, mTimestampNanos=9137836412311}
07-14 15:16:44.815 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-77, mTimestampNanos=9137977876790}
07-14 15:16:45.185 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-77, mTimestampNanos=9138347487363}
07-14 15:16:45.368 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-73, mTimestampNanos=9138530690487}
07-14 15:16:45.552 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-86, mTimestampNanos=9138714656789}
07-14 15:16:45.731 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-71, mTimestampNanos=9138893700487}
07-14 15:16:46.105 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-87, mTimestampNanos=9139266595748}
07-14 15:16:46.280 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-76, mTimestampNanos=9139442061164}
07-14 15:16:46.459 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-95, mTimestampNanos=9139622150747}
07-14 15:16:46.624 13592-13612/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=88:0F:10:0B:E1:56, mScanRecord=ScanRecord [mAdvertiseFlags=5, mServiceUuids=[0000fee0-0000-1000-8000-00805f9b34fb, 0000fee7-0000-1000-8000-00805f9b34fb], mManufacturerSpecificData={343=[0, -124, 89, -111, -77, -104, -1, -74, -66, -93, -112, -23, -14, 84, 106, -100, 113, 1, -120, 15, 16, 11, -31, 86]}, mServiceData={0000fee0-0000-1000-8000-00805f9b34fb=[7, 15, 0, 0]}, mTxPowerLevel=-2147483648, mDeviceName=MI1A], mRssi=-98, mTimestampNanos=9139786484185}
07-14 15:16:46.643 13592-13608/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=66:53:46:55:01:96, mScanRecord=ScanRecord [mAdvertiseFlags=26, mServiceUuids=null, mManufacturerSpecificData={76=[16, 3, 26, 0, 0]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-83, mTimestampNanos=9139805356893}
07-14 15:16:46.684 13592-13609/com.mobium1182.app D/BluetoothLeScanner: onScanResult() - ScanResult{mDevice=C3:77:13:2D:C1:64, mScanRecord=ScanRecord [mAdvertiseFlags=4, mServiceUuids=null, mManufacturerSpecificData={76=[2, 21, -71, 64, 127, 48, -11, -8, 70, 110, -81, -7, 37, 85, 107, 87, -2, 109, 18, 52, 26, 84, -61]}, mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=null], mRssi=-45, mTimestampNanos=9139845815695}
07-14 15:16:46.867 13592-13592/com.mobium1182.app D/BluetoothAdapter: stopLeScan()

我认为mDevice = C3:77:13:2D:C1:64是我的灯塔。问题是didEnterRegion()函数没有检测到它

P.S。我已经尝试更改BackgroundBetweenScanPeriod并禁用AndroidLScanning

BeaconManager beaconManager = BeaconManager.getInstanceForApplication(this);
BeaconManager.setAndroidLScanningDisabled(true);
beaconManager.setBackgroundBetweenScanPeriod(10000L);

我的Android版本是5.0.2

2 个答案:

答案 0 :(得分:0)

我怀疑用于进行前台处理的代码(根据问题工作)可能会禁用后台检测。如果您显示前景检测设置的详细信息可能会有所帮助。这仍然使用Application类中显示的代码吗?或者它是否在活动中单独设置?

一些提示:

  • 使用BootstrapNotifier时,请确保稍后在代码中不要致电beaconManager.setMonitorNotifier(...)。这将有效地禁用背景检测。

  • 如果上述方法无效,您可以尝试设置beaconManager.setDebug(true)并抓取新的日志记录摘录,其中会显示有关在后台扫描设备时发生的情况的更多详细信息,但您没有&#39 ;得到BootstrapNotifier回调。

答案 1 :(得分:0)

我发现了自己的错误。我只是在Beacon Manager中添加布局,现在它可以正常工作。

beaconManager.getBeaconParsers().add(new BeaconParser().setBeaconLayout(BeaconLayout.IBEACON.layout()));

这是我的布局

public enum BeaconLayout {

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

    private final String layout;

    BeaconLayout(String layout) {
        this.layout = layout;
    }

    public String layout() {
        return layout;
    }

}