打ze模式,电池优化白名单,AlarmManager的频率超过9分钟 [英] Doze Mode, Battery Optimization whitelist, AlarmManager more frequent than 9 mins

查看:290
本文介绍了打ze模式,电池优化白名单,AlarmManager的频率超过9分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个与BT设备连接的应用,以收集健康数据(即:体温)。

I'm creating an app to connect with BT device to collect heath data (i.e.: body temperature).

传感器会定期睡眠,仅在有限的时间范围内唤醒。

The sensor sleeps for periodic time and wakes up only for limited window of time to connect.

ve试图创建AlarmManager来使用 setExactAndAllowWhileIdle()触发前景服务,并且它在高于9分钟的时间段内按预期工作,

I've tried to create AlarmManager which fires Foreground Service with setExactAndAllowWhileIdle() and it is working as expected for periods higher than 9 minutes,

但在9分钟以下,它将进入打ze模式,并且不会触发AlarmManager BroadcastReceiver。

but below 9 minutes it goes to doze mode and do not fire AlarmManager BroadcastReceiver.

从文档中,我不了解将应用添加到电池优化白名单是否允许AlarmManager触发更多攻击
https:// developer .android.com / training / monitoring-device-state / doze-standby#support_for_other_use_cases

From documentation I do not understand if adding app to battery optimalization whitelist will allow AlarmManager to trigger more offen https://developer.android.com/training/monitoring-device-state/doze-standby#support_for_other_use_cases


例如,列入白名单的应用的作业和同步被推迟(在API级别23及以下),并且常规的AlarmManager警报不会触发

For example, the whitelisted app’s jobs and syncs are deferred (on API level 23 and below), and its regular AlarmManager alarms do not fire

常规警报是什么? setExactAndAllowWhileIdle()是否正常?

What are the regular alarms? is setExactAndAllowWhileIdle() regular?

任何澄清将不胜感激

编辑:

我了解到 setExactAndAllowWhileIdle()会在打ze模式下触发事件超过9分钟,问题是将应用添加到白名单是否会使它触发次数更多

I understand that setExactAndAllowWhileIdle() will trigger event in doze mode for periods longer than 9 minutes, question is does adding app to whitelist will allow it to trigger more often

推荐答案


常规警报是什么?是setExactAndAllowWhileIdle()常规的吗?

What are the regular alarms ? is setExactAndAllowWhileIdle() regular ?

否。 setExactAndAllowWhileIdle()不规则。常规警报可以是通过setExact()和setWindow()设置的AlarmManager警报。

No. setExactAndAllowWhileIdle() is not regular. Regular alarm could be AlarmManager alarms set though setExact() and setWindow().


,但是在9分钟以下会进入休眠模式,并且不会fire AlarmManager
BroadcastReceiver

but below 9 minutes it goes to doze mode and do not fire AlarmManager BroadcastReceiver

它对设置警报的频率有限制。

It has restrictions on how frequently you can set alarm.

基于文档


为减少滥用,对这些警报
发出的频率进行了限制针对特定的应用程序。在正常系统
的操作下,将不超过大约每分钟
分钟分发一次这些警报(此时将分发每个此类待处理的警报);
在低功率空闲模式下时,此持续时间可能会更长,例如
,例如15分钟。

您可以参考 ze睡限制表示:


标准AlarmManager警报(包括setExact()和setWindow())
推迟到下一个维护窗口。

Standard AlarmManager alarms (including setExact() and setWindow()) are deferred to the next maintenance window.


  • 如果您需要设置在打ze睡时触发的警报,请使用setAndAllowWhileIdle()或setExactAndAllowWhileIdle()。

  • 使用 setAlarmClock()设置的警报继续正常触发-在这些警报触发之前不久,系统退出Doze。

  • If you need to set alarms that fire while in Doze, use setAndAllowWhileIdle() or setExactAndAllowWhileIdle().
  • Alarms set with setAlarmClock() continue to fire normally — the system exits Doze shortly before those alarms fire

对于白名单:

白名单中可用的应用部分不受Doze和App Standby优化。这并不意味着他们在打ze睡模式下拥有完全访问权限并可以执行任务。被列入白名单的应用程序可以在Doze和App Standby期间使用网络并持有部分唤醒锁。但是,仍会施加其他限制,例如作业不同,标准警报触发

Apps available in whitelist are partially exempt from Doze and App Standby optimizations. This doesn't mean they have full access to and could perform tasks during doze mode. An app that is whitelisted can use the network and hold partial wake locks during Doze and App Standby. However, other restrictions like jobs being differed, standard alarm trigger are still imposed

注意:您应检查可接受的用例以将应用列入白名单。

Note: You should check acceptable usecases for whitelisting an app.


Google Play政策禁止应用要求直接免除Android 6.0+(打from和应用待机)中的电源管理功能的

,除非该功能的核心功能应用受到不利影响。

Google Play policies prohibit apps from requesting direct exemption from Power Management features in Android 6.0+ (Doze and App Standby) unless the core function of the app is adversely affected.

这篇关于打ze模式,电池优化白名单,AlarmManager的频率超过9分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆