3

Actually I have two apps affected. One uses the phone as a video server. The other allows the user to download large files. I'm pretty sure both of these will be affected by doze mode as those actions can take several hours. It seems like Google is removing apps that request to be whitelisted.

So what are my options?

casolorz
  • 8,486
  • 19
  • 93
  • 200

2 Answers2

0

You can choose to display a dialog box that takes the user through the steps for disabling Doze Mode.

FYI : Doze mode can be simply disabled in settings menu, for specific apps by :

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.

Edit : Try this to take the user to battery settings of the phone:

Intent newIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);        
startActivity(newIntent);
Ankur Aggarwal
  • 2,210
  • 2
  • 34
  • 39
  • Thanks. Is there a way to take them to that screen directly or at least as close as possible? – casolorz Nov 17 '15 at 19:57
  • 1
    Excluding an app from battery optimizations does not disable doze mode! http://developer.android.com/intl/ja/training/monitoring-device-state/doze-standby.html -> Support for Other Use Cases: "An app that is whitelisted can use the network and hold partial wake locks during Doze and App Standby. However, other restrictions still apply to the whitelisted app, just as they do to other apps..." – sec_aw Nov 18 '15 at 21:32
0

If your apps are using foreground services with the associated notifications they will not be affected by doze mode. But make sure, they are running in a different process from your main activity, as there seems to be a bug currently, where foreground services in the same process will be affected. See Wake lock disabled in foreground service with Doze mode - new battery optimizations in Android M

Community
  • 1
  • 1
sec_aw
  • 1,594
  • 1
  • 15
  • 26
  • I do have a foreground service and a notification and I've seen people mention this but I didn't see it on the Google documentation. Thanks. – casolorz Nov 18 '15 at 15:09
  • Yes, it's not in the official documentation which lacks information about many details on the impact of doze mode. But the behavior is publicly confirmed by Android developers, for details see my answer to this question http://stackoverflow.com/questions/33018306/doze-mode-and-foreground-service I suggest, you do your own testing though... – sec_aw Nov 18 '15 at 21:26