Questions tagged [android-doze]

Doze mode introduced with Android 6.0 Marshmallow as a power-saving feature.

The Doze mode was introduced with Android 6.0 Marshmallow to improve the power usage of the device. If the device is not charging and had no user interaction for some time, the usage of CPU and network gets restricted by deferring background tasks and executing them in batches during maintenance windows.

191 questions
51
votes
3 answers

Minimal android foreground service killed on high-end phone

I'm trying to create an app that lets users log routes (locations/GPS). To ensure locations are logged even when the screen is off, I have created a foreground service for the location logging. I store the locations in a Room Database which is…
48
votes
3 answers

How do I properly fire ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS intent?

As stated in the documentation: "An app holding the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission can trigger a system dialog to let the user add the app to the whitelist directly, without going to settings. The app fires a…
28
votes
2 answers

Battery-saver + phone-call-intent => no Internet?

Note: as it turns out, the original question was incorrect in its assumptions. See more details on its edits at the bottom. It's now about the battery-saver, and not battery-saver&doze-mode. It's also not about Service&BroadcastReceiver, but just…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
26
votes
1 answer

How does doze mode affect background/foreground services, with/without partial/full wakelocks?

This is a simple question, seeing that there is a huge post about this on G+ (here), and lack of information on official docs (here ): What happens to the app's services when the device goes to "doze" mode? What does it do to background/foreground…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
26
votes
5 answers

How to shift device in Doze Mode (Android Preview M / Marshmallow)?

I followed steps described here: https://developer.android.com/preview/testing/guide.html#doze-standby Circumstances: Android Debug Bridge version 1.0.32 Nexus 9 with Preview M Shell: $ adb shell dumpsys battery unplug => worked, device…
A.D.
  • 1,412
  • 2
  • 19
  • 37
25
votes
4 answers

Android Alarm Manager setExactAndAllowWhileIdle() not working in Android 7.0 Nougat in Doze mode

I am trying to make an alarm fire in my app every 30 minutes using Alarm Manager's setExactAndAllowWhileIdle but it is not working! I test the functionality by issuing a push notification whenever I receive an alarm signal. The problem is: when the…
23
votes
1 answer

Understanding & testing Android M+ Doze Mode

I am working on making my Android app a good citizen of the post Android M world which imposes severe constraints on what an app can/cannot do when the device goes into doze. My understanding of the issues involved is still rather fragmentary so I…
DroidOS
  • 8,530
  • 16
  • 99
  • 171
19
votes
5 answers

Android Notifications triggered by Alarm Manager not Firing when App is in Doze Mode

I have the following requirements. A user needs to be able to schedule a recurring reminder in my app that will trigger a push notification at an exact time every day. This is one of those questions that I hoped I would end up not submitting as…
pat8719
  • 1,700
  • 1
  • 26
  • 47
19
votes
2 answers

Android 7.0 (Nougat) Doze Mode Stops Web Service

I have an Android foreground service with a WiFi lock that acts as a web service for another local device. Before Doze mode, acquiring a WiFi lock and being a service as needed worked great. Even with battery optimizations turned off for my app, the…
Justin
  • 3,322
  • 2
  • 22
  • 37
17
votes
0 answers

How to detect if App has gone in or out of App Standyby Mode ( Android M+)

If the device is in DOZE IDLE or IDLE_MAINTENANCE mode, these events can be received if we register a broadcast receiver for "android.os.action.DEVICE_IDLE_MODE_CHANGED". But this receiver is not working when making App to go into App Standby using…
13
votes
1 answer

Android - Repeating Alarms Allowed While Idle

I need to set a repeating alarm every X hours that would even fire in doze mode. However, the only Apis available in AlarmManager for Android 23 are setExactAndAllowWhileIdle and setAndAllowWhileIdle which are not for repeating alarms. I am…
11
votes
2 answers

PowerManager.isIgnoringBatteryOptimizations always returns true even if is removed from 'Not optimized apps'

I have a mileage logbook app which does GPS tracking and is able to establish a OBDII connection to a car in background. Now I want to show a Popup which informs the users if my app is not whitelisted in doze since this may stop my background…
stefan
  • 1,336
  • 3
  • 21
  • 46
11
votes
1 answer

How to deal with Huawei's and Xiaomi's "battery optimizations"

I have an app that listens for notifications via NotificationListenerService. My app survives both the Doze mode and app stand by on almost any phone (if properly set-up e.g. exception or a foreground service). Then come the Huawei and Xiaomi with…
11
votes
1 answer

How to test Doze Mode on Android?

There is an old Android app which work background 2 service (Service). It took to update the app with the possibility of sending data and logging while working is not a new DozeMode. Before you amend the current code I decided to check how…
abbath0767
  • 946
  • 2
  • 11
  • 31
10
votes
2 answers

Doze mode - do foreground services continue to run?

im so confused reading this and trying to figure out if foreground services will run when the device goes into deep doze mode. Could someone clarify. I want to know on marshmallow and upwards if foreground services can continue to run. I always…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
1
2 3
12 13