- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在运行 Android 4.3 的三星 Galaxy Tab 2 上使用专业版 Radius Networks iBeacon SDK 进行开发。该应用程序已经成功使用非专业版 0.7 一个月了,但我想要后台事件,所以我已经转到专业版 1.0。 AndroidProximityLibrary项目是Eclipse中的项目依赖,ProximityKit.properties
文件在src/
。
以下代码是我的应用程序子类,如 documentation 中所述。该应用程序具有 BLUETOOTH 和 BLUETOOTH_ADMIN 权限。从 LogCat 输出中可以看出,didDetermineStateForRegion()
方法在进入休眠状态后未按预期调用。必须改变什么才能在后台发生某些事情?
我看到了一个名为 iBeacon background scanning PRO feature of RadiusNetworks library? 的类似问题,但问题似乎是调用 IBeaconManager.unbind()
导致操作系统清理服务。我的代码从不调用 IBeaconManager.unbind()
,只调用 IBeaconManager.bind()
。
public class ExampleApp extends Application implements BootstrapNotifier, IBeaconConsumer {
private static final String LOG_TAG = ExampleApp.class.getName();
private RegionBootstrap regionBootstrap;
private IBeaconManager iBeacon;
private Region region;
public ExampleApp() {
String uuid = "EBEFD083-70A2-47C8-9837-E7B5634DF520";
region = new Region("com.example.ble", uuid, null, null);
}
@Override
public void onCreate() {
super.onCreate();
iBeacon = IBeaconManager.getInstanceForApplication(this);
iBeacon.setBackgroundBetweenScanPeriod(10000);
iBeacon.setBackgroundScanPeriod(3000);
iBeacon.bind(this);
regionBootstrap = new RegionBootstrap(this, region);
}
@Override
public void onIBeaconServiceConnect() {
Log.d(LOG_TAG + ".onIBeaconServiceConnect", "connected to iBeacon service");
try {
iBeacon.startRangingBeaconsInRegion(region);
} catch (RemoteException e) {
String msg = "caught exception while enabling beacon ranging";
Log.e(LOG_TAG + ".onIBeaconServiceConnect", msg, e);
}
}
@Override
public void didEnterRegion(Region region) {
Log.d(LOG_TAG + ".didEnterRegion", "YEAH ENTERED");
}
@Override
public void didDetermineStateForRegion(int state, Region region) {
Log.d(LOG_TAG + ".didDetermineStateForRegion", "YEAH STATE");
Intent intent = new Intent(this, LaunchActivity.class);
startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
@Override
public void didExitRegion(Region region) {
Log.d(LOG_TAG + ".didExitRegion", "YEAH EXITED");
}
}
我在信标范围外运行应用程序,然后走进范围内。 30 秒后没有任何反应,所以我按下电源按钮,但仍然没有任何反应。我插上电话,从亚行那里得到了踪迹。
05-28 14:05:23.456: I/PowerManagerService(2392): [ps] Screen__Off(0) : goToSleepFromNative: (uid: 1000 pid: 2392)
05-28 14:05:23.456: I/PowerManagerService(2392): Going to sleep by user request...
05-28 14:05:23.471: W/KeyguardViewMediator(2392): wakeUpIfNeeded() mMaybeShow=true mRequestedWakeUp=false mShowing=false
05-28 14:05:23.516: E/SEC PowerHAL(2392): sysfs_write : Error opening /sys/class/input/input11/enabled: No such file or directory
05-28 14:05:23.516: E/SEC PowerHAL(2392): sysfs_write : Error opening /sys/class/input/input1/enabled: No such file or directory
05-28 14:05:23.516: E/SEC PowerHAL(2392): sysfs_write : Error opening /sys/class/input/input10/enabled: No such file or directory
05-28 14:05:23.521: I/libsuspend(2392): !@[s] autosuspend_earlysuspend_enable : 40
05-28 14:05:23.521: I/libsuspend(2392): !@[s] wait_for_fb_sleep : 40 (1, 0) -
05-28 14:05:23.521: I/libsuspend(2392): !@[s] autosuspend_earlysuspend_enable done : 40
05-28 14:05:23.521: I/libsuspend(2392): !@[s] wait_for_fb_wake : 40 (0, 0) +
05-28 14:05:23.521: I/PowerManagerService(2392): [PWL] Off : 0s ago
05-28 14:05:23.521: I/PowerManagerService(2392): [PWL] PowerManagerService.WakeLocks: ref count=1
05-28 14:05:23.521: I/PowerManagerService(2392): [PWL] PowerManagerService.Broadcasts: ref count=1
05-28 14:05:23.521: I/PowerManagerService(2392): [PWL] mWakeLockSummary : 0x1
05-28 14:05:23.521: I/PowerManagerService(2392): [PWL] PARTIAL_WAKE_LOCK 'ActivityManager-Sleep' (uid=1000, pid=2392, ws=null) (elapsedTime=42)
05-28 14:05:23.526: I/CAE(2392): onReceive(CaPowerManager.java:142) - AP_SLEEP
05-28 14:05:23.531: I/CAE(2392): sendCmdToSensorHub(SensorHubCommManager.java:146) - -76, 13, -46, 0,
05-28 14:05:23.561: I/CAE(2392): parse(SensorHubParserProvider.java:136) - buffer size = 3
05-28 14:05:23.561: I/CAE(2392): parse(SensorHubParserProvider.java:147) - 2, 1, -46,
05-28 14:05:23.591: I/AudioHardwareTinyALSA(1989): setParameters(screen_state=off)
05-28 14:05:23.591: I/audio_wfd_hw(1989): adev_set_parameters() screen_state=off
05-28 14:05:23.616: I/NfcService(2909): # NativeNfcBrcmPowerMode; setPowerMode(android.intent.action.SCREEN_OFF)
05-28 14:05:23.621: E/NfcService(2909): callback == null
05-28 14:05:23.691: I/AutoBackupUtil(9627): checkAutoBackupCondition returns : false
05-28 14:05:23.691: I/AutoBackupUtil(9627): bChargerConnected : true
05-28 14:05:23.691: I/AutoBackupUtil(9627): bWifiConnected : false
05-28 14:05:23.691: I/AutoBackupUtil(9627): bScreenOn : false
05-28 14:05:24.871: I/SurfaceFlinger(1986): id=996 Removed Uoast (5/6)
05-28 14:05:24.871: I/SurfaceFlinger(1986): id=996 Removed Uoast (-2/6)
05-28 14:05:28.526: I/PowerManagerService(2392): [PWL] Off : 5s ago
05-28 14:05:38.541: I/PowerManagerService(2392): [PWL] Off : 15s ago
05-28 14:05:51.251: E/Watchdog(2392): !@Sync 8274
05-28 14:05:53.556: I/PowerManagerService(2392): [PWL] Off : 30s ago
05-28 14:05:55.986: E/BatteryService(2392): Could not open /efs/FactoryApp/batt_cable_count
05-28 14:05:56.081: E/Sensors(2392): Light old sensor_state 0, new sensor_state : 64 en : 1
05-28 14:05:56.096: I/SensorService(2392): info.selectDelay() ns=200000000
05-28 14:05:56.101: I/PowerManagerService(2392): [ps] Screen__On(wake lock) : wl: charger plug
05-28 14:05:56.101: I/PowerManagerService(2392): Waking up from sleep...
05-28 14:05:56.126: I/libsuspend(2392): !@[s] autosuspend_earlysuspend_disable : 41
05-28 14:05:56.151: I/KeyguardBackgroundView(2392): *** KeyguardEffectView getInstance ***
05-28 14:05:56.151: I/WindowManager(2392): No lock screen!
05-28 14:05:56.196: I/NfcService(2909): # NativeNfcBrcmPowerMode; setPowerMode(android.intent.action.USER_PRESENT)
05-28 14:05:56.266: E/videowall-TranscodeReceiver(10819): broadcastMSG : android.intent.action.ACTION_POWER_CONNECTED
05-28 14:05:56.276: I/EntropyMixer(2392): Writing entropy...
05-28 14:05:56.281: E/Sensors(2392): Light old sensor_state 64, new sensor_state : 0 en : 0
05-28 14:05:56.326: I/CAE(2392): onReceive(CaPowerManager.java:150) - POWER_CONNECTED
05-28 14:05:56.326: I/CAE(2392): sendCmdToSensorHub(SensorHubCommManager.java:146) - -76, 13, -42, 0,
05-28 14:05:56.426: E/Launcher(2928): Error finding setting, default accessibility to not found: accessibility_enabled
05-28 14:05:56.536: I/SSRMv2:Monitor(2392): fileWriteInt : /sys/class/power_supply/battery/siop_level value : 100
05-28 14:05:56.546: E/Sensors(2392): Light old sensor_state 0, new sensor_state : 64 en : 1
05-28 14:05:56.556: I/SensorService(2392): info.selectDelay() ns=200000000
05-28 14:05:56.556: E/Sensors(2392): Light old sensor_state 64, new sensor_state : 0 en : 0
05-28 14:05:56.556: E/MotionRecognitionService(2392): mReceiver.onReceive : ACTION_USER_PRESENT :: UNLOCK SCREEN
05-28 14:05:56.571: E/BatteryService(2392): Could not open /efs/FactoryApp/batt_cable_count
05-28 14:05:56.576: I/libsuspend(2392): !@[s] wait_for_fb_wake : 41 (1, 0) -
05-28 14:05:56.576: I/libsuspend(2392): !@[s] wait_for_fb_sleep : 41 (0, 0) +
05-28 14:05:56.576: I/libsuspend(2392): !@[s] autosuspend_earlysuspend_disable done : 41
05-28 14:05:56.576: E/SecTVOutService(1986): virtual void android::SecTVOutService::setHdmiStatus(uint32_t)::mSecHdmi.connect() fail
05-28 14:05:56.576: E/SEC PowerHAL(2392): sysfs_write : Error opening /sys/class/input/input11/enabled: No such file or directory
05-28 14:05:56.576: E/SEC PowerHAL(2392): sysfs_write : Error opening /sys/class/input/input1/enabled: No such file or directory
05-28 14:05:56.576: E/SEC PowerHAL(2392): sysfs_write : Error opening /sys/class/input/input10/enabled: No such file or directory
05-28 14:05:56.616: I/CAE(2392): onReceive(CaPowerManager.java:146) - AP_WAKEUP
05-28 14:05:56.616: I/CAE(2392): sendCmdToSensorHub(SensorHubCommManager.java:146) - -76, 13, -47, 0,
05-28 14:05:56.681: I/AudioHardwareTinyALSA(1989): setParameters(screen_state=on)
05-28 14:05:56.681: I/audio_wfd_hw(1989): adev_set_parameters() screen_state=on
05-28 14:05:56.796: E/SELinux(11287): Function: selinux_android_load_priority [0], There is no sepolicy file
05-28 14:05:56.796: E/SELinux(11287):
05-28 14:05:56.801: E/SELinux(11287): Function: selinux_android_load_priority , loading version is VE=SEPF_GT-N7105_4.3_0021
05-28 14:05:56.801: E/SELinux(11287):
05-28 14:05:56.801: E/SELinux(11287):
05-28 14:05:56.801: E/SELinux(11287): selinux_android_seapp_context_reload: seapp_contexts file is loaded from /data/security/spota/seapp_contexts
05-28 14:05:56.821: I/NfcService(2909): NFC: When Screen On, S View Cover also Open!!
05-28 14:05:56.821: I/NfcService(2909): # NativeNfcBrcmPowerMode; setPowerMode(android.intent.action.SCREEN_ON)
05-28 14:05:56.841: I/CAE(2392): parse(SensorHubParserProvider.java:136) - buffer size = 3
05-28 14:05:56.841: I/CAE(2392): parse(SensorHubParserProvider.java:147) - 2, 1, -47,
05-28 14:05:56.871: I/ActivityManager(2392): Killing proc 11287:com.sec.android.SimpleWidget/u0a10145: force stop com.sec.android.SimpleWidget
05-28 14:05:56.886: W/ActivityManager(2392): Permission denied: checkComponentPermission() owningUid=10029
最佳答案
当使用 RegionBootstrap
时,您不需要调用 iBeacon.bind(this);
也不需要 onIBeaconServiceConnect()
的实现>。这是因为这些任务由 RegionBootstrap
类在内部处理。
要解决此问题,请尝试取消对 iBeacon.bind(this);
关于android - 使用 Radius Networks Pro iBeacon SDK 的后台 BLE 触发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23904130/
我正在开发一个使用 BLE Android 到 iOS 的聊天应用程序,现在我正在使用下面两个库作为引用 https://github.com/izumin5210/Bletia https://gi
我正在从 HCI 套接字接收 EVT_LE_ADVERTISING_REPORT。我想区分 BLE 信标和普通 BLE 设备(解析设备名称等)我有点困惑是否所有 BLE 设备都会发出信标或者它们是不同
我正在从 HCI 套接字接收 EVT_LE_ADVERTISING_REPORT。我想区分 BLE 信标和普通 BLE 设备(解析设备名称等)我有点困惑是否所有 BLE 设备都会发出信标或者它们是不同
我在我的 iOS 应用程序项目中使用核心蓝牙框架。我有以下关于蓝牙低功耗的问题 - iOS 中单个中央设备是否可以连接多个外围设备? 多个中央设备可以与单个外围设备连接吗? 单个 iOS 设备可以同时
我正在创建一个 iOS 和一个 Android 应用程序,它们从蓝牙传感器读取一些数据并将它们保存在数据库中。 即使应用程序终止,我也想提供保存传感器数据的能力。 仅供引用。当应用程序在后台时,我已经
我正在使用核心蓝牙框架并扫描一些设备,例如 micromax A250、micromax A116、samsung grand neo、HTC 610 和 ipod 5s,然后我无法扫描 samsun
这个任务的目的是通过BLE设备连接iPhone的BLE,访问iphone的ANCS。请注意,iPhone 中没有安装应用程序来打开 iPhone 的 BLE。那么,如果我们从 iPhone 设置中启用
我在为我的 BLE 设备开发安卓软件时遇到了问题。我的软件可以找到我的设备和 GATT 服务,但在我的服务中找不到任何特征。 我检查了 android-sdk-4.4.2 源码,找到了一些代码。 ht
有什么方法可以从 BleExplr、LightBlue 等通用 BLE 扫描应用程序中隐藏 BLE 设备? 最佳答案 您可以配置外围设备以使用服务请求。在这种模式下,中央为它们提供服务和外设扫描 -
我有 3 个组件。 Activity1 有连接和断开 BLE 连接的按钮 Activity2 需要从 BLE 设备获取数据。 Service 所有连接逻辑(如 getRemoteDevice()、co
我有一个 BLE 设备,它在通过相当标准的用户界面(点击 UITableView 中显示的设备条目)选择后连接到 iOS 设备。 连接非常简单 - 一些内部处理,然后调用 CBCentralManag
我正在尝试使用 Meteor 和这个 Cordova 插件 - https://github.com/don/cordova-plugin-ble-central - 使用 meteor add co
我坚持在 Android Lollipop 智能手机和 BLE 设备(带有 BLE 模块的 TI 实验板)之间实现连接。我使用以下调用进行连接: device.connectGatt(context,
我正在使用 react-native-ble-plx 在我的应用程序中实现蓝牙 蓝牙扫描工作正常,但它在 android 中包含重复项,而在 iOS 中工作正常,因为 allowDuplicates
我正在尝试在我的 Windows 笔记本电脑上设置一个基于 Nodejs 的演示,并使用额外的 BLE 适配器将我的笔记本电脑连接到另一个 BLE 设备 (Anki Overdrive)。我在互联网上
我正在研究基于 Android 的 BLE 接近感应功能,需要一些信息。目前我看到没有适用于 android 的 BLE 信标制造商。到目前为止,我为 iPhone 找到了 2 个。1) http:/
我正在使用 cordova 和 BLE 插件开发一个应用程序。我想通过 BLE 根据硬编码的已知 device.name 自动连接到 ESP32,而无需用户按下连接按钮。 我的想法是: 在设备准备就绪
我正在尝试实现从/向蓝牙设备接收和发送消息的模块。 我一直在寻找可以通过蓝牙搜索、连接和发送消息的 NuGet 包,但找不到适用于 Linux 的任何东西。 我正在使用 .NET Core 2.1 和
我正在尝试寻找一种方法来了解如何在 iOS 中获取 BLE mac??? 这将适用于所有 BLE,不会存在制造商依赖性。我们正在寻找扫描时间的解决方案。我可以在扫描时间内区分 BLE 吗? 如果获取M
我已阅读技术规范并试图了解为什么 BLE 4.2 比 BLE 4.1 更快? 我们能否发送大于 20 字节的数据包或者连接间隔是否更快? 我想了解是什么让 BLE 4.2 更快。 最佳答案 与早期相比
我是一名优秀的程序员,十分优秀!