gpt4 book ai didi

android - 如何让我的 android 应用程序以超省电模式显示

转载 作者:IT老高 更新时间:2023-10-28 23:15:00 25 4
gpt4 key购买 nike

一些三星设备有一个 super 省电模式,它会关闭 wifi,将屏幕变为灰度并将使用限制为一些基本应用程序。

但是,它确实允许您添加一些随后可以使用的应用程序。这些应用程序包括 Facebook 和 WhatsApp。如何让我的应用出现在此列表中?我必须对应用程序进行哪些更改才能使其出现在此列表中?还是这个名单是基于三星维护的白名单?

最佳答案

可以使用REQUEST_IGNORE_BATTERY_OPTIMIZATIONS权限.此权限不需要明确的用户权限。所以将被授予。虽然这不会阻止用户手动停止应用程序。

来自 the docs :

This is a normal permission: an app requesting it will always be granted the permission, without the user needing to approve or see it.

ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS会将应用程序添加到设备的白名单中。

isIgnoringBatteryOptimizations会通知您该应用是否已列入白名单。

来自 the docs 的一些笔记:

Note: most applications should not use this; there are many facilities provided by the platform for applications to operate correctly in the various power saving modes. This is only for unusual applications that need to deeply control their own execution, at the potential expense of the user's battery life. Note that these applications greatly run the risk of showing to the user as high power consumers on their device.

Input: The Intent's data URI must specify the application package name to be shown, with the "package" scheme. That is "package:com.my.app".

我不建议滥用它。

有一个列表Acceptable Use Cases for Whitelisting .

In general, your app should not be on the whitelist unless Doze or App Standby break the core function of the app or there is a technical reason why your app cannot use FCM high-priority messages.

感谢 adsamcik获取此最新链接。

关于android - 如何让我的 android 应用程序以超省电模式显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39083670/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com