我买了一部新手机(Lava A44)在Nougat上测试我的应用程序。它具有电池设置功能,似乎没有在Android文档中解释(见下面的屏幕截图):
我在我的应用程序中使用Handler#postDelayed()并且它在前台工作正常并且在某个时候应用程序停止获取FCM消息并且不会触发postDelayed,除非我关闭"应用程序冰箱"和同步唤醒"如图所示。
默认情况下,WhatsApp和Facebook会发现这些设置为关闭。
正如其他帖子所建议的,我已经尝试过AlarmManager.setAndAllowWhileIdle(),ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,PowerManager#isIgnoringBatteryOptimizations,但无济于事。这似乎是针对Android N的一些制造商特定的定制。
我的问题是:
修改 我尝试下面和下面的cricket_007评论是adb输出:
Running activities (most recent first):
TaskRecord{c79fa27 #421 A=com.android.settings U=0 StackId=1 sz=4}
Run #5: ActivityRecord{b7bd3c3 u0 com.android.lava.powersave/.ui.SmartAppManagerSettinsActivity t421}
Run #4: ActivityRecord{a55162f u0 com.android.lava.powersave/.ui.SmartAppManagerActivity t421}
Run #3: ActivityRecord{c91700c u0 com.android.lava.powersave/.ui.LavaPowerSaveManager t421}
Run #2: ActivityRecord{b60d04d u0 com.android.settings/.Settings t421}
它似乎是制造商特定的自定义,因此我无法从我的应用程序打开屏幕。从其他帖子来看,即便是三星手机也有这样的功能。是否有针对一般情况检测或打开此类屏幕的想法?