[英]Ble beacon Android Oreo and P not waking app from doze mode
I have an app that uses Bluetooth Beacons. 我有一个使用蓝牙信标的应用程序。 When app is in doze mode proximity notifications from bluetooth beacons are not waking the phone.
当应用程序处于打ze模式时,来自蓝牙信标的邻近通知不会唤醒手机。 It is only when I unlock phone that the notification is delivered.
仅当我解锁手机时,通知才会发送。 This issue is the same for foreground or app that has been killed.
对于已被杀死的前景或应用程序,此问题相同。
Starting with Android 6.0, Doze mode blocks any bluetooth scan callbacks or other events, including beacon detections. 从Android 6.0开始, 打ze模式会阻止所有蓝牙扫描回调或其他事件,包括信标检测。 I discussed this issue with Android Bluetooth engineers during a session at Google I/O 2015. Their position was that because sensed motion will exit Doze mode, this is not an issue, since a phone typically cannot discover new bluetooth beacons when it is motionless and therefore presumably in the same place.
我在Google I / O 2015上的一次会议上与Android蓝牙工程师讨论了此问题。他们的立场是,由于感应到的运动将退出打Do模式,因此这不是问题,因为手机在静止不动时通常无法发现新的蓝牙信标,因此大概在同一地方。
While this is true for most use cases, there are a few exceptions: (1) On a train or other vehicle in a single direction on a straight path, the accelerometer won't detect motion and the phone may go into Doze despite being in motion and potentially seeing new beacons. 尽管在大多数使用情况下都是如此,但有一些例外:(1)在火车或其他车辆上,在一条直线路径上的单个方向上,加速度计将无法检测到运动,尽管手机处于运动并可能看到新的信标。 (2) In some use cases, beacon advertisements are built to be dynamic, so they appear and disappear in the same case.
(2)在某些用例中,信标广告被构建为动态的,因此它们在同一情况下出现和消失。 In both of these situations Android devices are simply unable to detect new beacon advertisements if they are in Doze mode.
在这两种情况下,如果Android设备处于打ze模式,则它们根本无法检测到新的信标广告。
This is an unfortunate limitation you must simply design around. 这是一个不幸的限制,您必须简单地进行设计。
EDIT: Starting with Android 7 there are two types of Doze mode, heavy and light. 编辑:从Android 7开始,有两种类型的打ze模式,重和轻。 Light doze mode kicks in when the screen is off but the phone is not motionless.
当屏幕关闭但手机并非静止不动时,轻打ze模式即会启动。 Heavy doze mode kicks in when the screen is off and the device is motionless for a period of time.
屏幕关闭且设备在一段时间内保持静止不动时,将进入“重打ze睡”模式。 In light doze mode, beacon detections are delivered normally.
在轻打ze模式下,信标检测正常传递。 In heavy doze mode, they are not supposed to be according to Google.
在重打ze睡模式下,他们不应该根据Google的说法。 However, on some devices they do.
但是,在某些设备上确实如此。 I see them delivered in heavy doze mode on a Samsung Galaxy S8 with Android 8.0 with a foreground service running.
我看到它们在运行Android 8.0且运行前台服务的Samsung Galaxy S8上以沉睡模式交付。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.