android - 我的应用程序使用手机作为服务器,我应该如何处理打瞌睡模式?

标签 android android-6.0-marshmallow

实际上我有两个应用受到影响。一种使用手机作为视频服务器。另一个允许用户下载大文件。我很确定这两者都会受到打瞌睡模式的影响,因为这些操作可能需要几个小时。谷歌似乎正在删除请求列入白名单的应用程序。

那么我的选择是什么?

最佳答案

您可以选择显示一个对话框,引导用户完成禁用打盹模式的步骤。

仅供引用:对于特定的应用程序,可以在设置菜单中简单地禁用打瞌睡模式:

Go to phone Settings. Press Battery. press the Options menu button (in the upper right corner, then press Battery optimization. Press the selector, then press All apps . Battery optimization list appears. After this, press the name of the app for which you want to switch off Doze mode, and in the box that appears, press "Don’t optimize". Once you’re done, select Done.

编辑: 试试这个让用户进入手机的电池设置:

Intent newIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);        
startActivity(newIntent);

关于android - 我的应用程序使用手机作为服务器,我应该如何处理打瞌睡模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33764024/

相关文章:

android - Volley ClientError 意外响应代码 404

android - AppCompatActivity 和 Marshmallow 权限

android - PhoneGap3 (Android) - VideoPlayer 插件坏了?备择方案?

java.lang.ClassNotFoundException : Didn't find class . 应用程序”路径:DexPathList

android渲染使用CPU而不是GPU?

android - 最初在列表中不可见时未选中 MultiSelectListPreference 复选框(API 23)

Android 6.0 更新导致 DB sqlite 在 init 期间崩溃

android - 在 Android 中获取 Activity 的应用程序名称

java - 无法读取从一个 BLE 设备发送到其他设备的特征值

单个对话框中的 Android 多个运行时权限