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
5
votes
1 answer

Broadcast receiver doesn't work inside foreground service in Android 8

I'm trying to create an app that allows users to silence the device during set time intervals or manually. I would also like users to be able to enter more complex rules such as mute the phone only when connected to a certain WiFi network, Bluetooth…
5
votes
1 answer

Repeating Task in Foreground service in Doze mode

I'm working on an application in which I have to do some repeating task at fixed interval (let's say after 2 mins) which should complete even in doze mode. My observations are mentioned below - Doing repeating task using Alarms (using RTC flag)…
5
votes
1 answer

Get location every 15 seonds even in doze mode

I want to get location every 15 sec and everything is ok, but in doze mode(deep sleep) my handler not working, is anyway? AlarmManager is good way but the time limit is 1 min is not repeated in doze mode. @ReactMethod public static void…
Mohsen
  • 1,415
  • 1
  • 13
  • 26
5
votes
1 answer

How to differentiate between the device entering a Doze maintenance window and coming out of Doze

I have a method which periodically runs to keep a network connection alive. During Doze mode, I would like to disable it from running periodically and run exactly once during a maintenance window. When the device comes out of Doze, I would like the…
rhari
  • 1,367
  • 1
  • 11
  • 19
5
votes
1 answer

Android VoIP application: PARTIAL_WAKE_LOCK vs ignoring Battery Optimizations (doze whitelisting)

I'm working on a Voice over IP (VoIP) application using the SIP protocol which requires the application to be listening to incoming calls. This means the application must not sleep or die. For old code, it seems the way to do this is to acquire a…
Emmanuel
  • 16,791
  • 6
  • 48
  • 74
5
votes
0 answers

Scheduling Repeating Events -- Handler.PostDelayed and Doze

Context I'm working on a screen filter app (like f.lux) for Android. I'm currently working the feature to gradually fade in the filter as the sun sets. The state does not matter when the screen is off, but when the screen is on, it's important that…
Julian Delphiki
  • 403
  • 4
  • 9
5
votes
0 answers

Do the latest Android updates disable the battery optimization whitelist?

TL;DR Did the 'June 5, 2017' security updates for Android 7.1.2 cause Android to start ignoring the battery optimization whitelist (i.e. the thing that's meant to let an app disable Doze mode)? And if so, how can an app now programmatically…
aroth
  • 54,026
  • 20
  • 135
  • 176
5
votes
1 answer

Doze mode handling

I am working on an application which spawns some services in the background using AlarmManager. Timing is very crucial to our application and the functionality can't wait for the next maintenance window to occur. Asking a user to white-list the…
5
votes
2 answers

Geofence works but after a while stops triggering

My Geofence is working at start but then all of a sudden after a day or two stops triggering, is there a problem on Google side here or my code? Upon boot and starting the app I use an IntentService that then registers a Geofence: public class…
4
votes
1 answer

Android get Location in app widget - locationManager seems to stop working after a while

TL:DR; Short Story An App Widget, in the home screen, fails to get a GPS position from an IntentService that uses LocationManager::getLastKnownLocation because after a while that the App is in the background or loses focus, the Location returned is…
4
votes
0 answers

Open Battery Optimization activity of specific app in device settings

I am using WorkManager library to schedule a background task, and to prevent the app from sleeping the battery optimization section is opened from the app for the users to manually disable optimization for my app. The problem is even though the…
4
votes
0 answers

Automated tests with Doze mode on android

I am trying to write some automated tests for how my app functions when the device enters and exits Doze mode. I know that you can use dumpsys deviceidle force-idle to force the device into idle mode when doing manual testing. Is there a way to run…
joelw
  • 401
  • 3
  • 11
4
votes
0 answers

Manually set a new alarm with setExactAndAllowWhileIdle() each time the alarm goes off: Android

I know that this has been asked several times before, but I have not been able to find something that could work for me till now. I am using setRepeating() to schedule the alarm manager to run every minute. However, this has stopped working after…
4
votes
1 answer

Foreground service not receiving location updates in Doze mode in Android O

I have a foreground service that needs to get a single location update. It is started by a specific broadcast, and upon starting it simply does a request on our backend. When it receives another broadcast, it requests a location update (once), does…
Jukurrpa
  • 4,038
  • 7
  • 43
  • 73
4
votes
0 answers

Internet music player can't load songs when device locked (Doze mode?)

I'm building a music player which plays songs from the internet. What I notice is that, often, when a song ends and another one has to be loaded, the app does not play the following song. I wait, wait, wait when finally I decide to unlock my phone…
Massimo
  • 3,436
  • 4
  • 40
  • 68
1 2
3
12 13