android-doze

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

我怕爱的太早我们不能终老 提交于 2021-01-27 06:36:15
问题 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 method to be called periodically again. How can I accomplish this ? I have registered a receiver that listens for the PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED broadcast and then calls PowerManager.isDeviceIdleMode() . However, this return false

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

情到浓时终转凉″ 提交于 2021-01-27 06:35:32
问题 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 method to be called periodically again. How can I accomplish this ? I have registered a receiver that listens for the PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED broadcast and then calls PowerManager.isDeviceIdleMode() . However, this return false

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

一世执手 提交于 2021-01-27 06:35:17
问题 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 method to be called periodically again. How can I accomplish this ? I have registered a receiver that listens for the PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED broadcast and then calls PowerManager.isDeviceIdleMode() . However, this return false

how to turn off doze mode for specific apps in marshmallow devices programmatically

馋奶兔 提交于 2020-01-23 02:44:48
问题 Marshmallow APIs are very different from previous android OS. When screen is off, devices are in doze mode and unable to sync network. So for doing background operations with network we have to prevent from doze mode. 回答1: Add below permission to manifest.xml <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> Call below method public void turnOffDozeMode(Context context){ //you can use with or without passing context if(Build.VERSION.SDK_INT >= Build

Android N Doze mode - how to keep background download and processing?

旧时模样 提交于 2020-01-17 06:18:16
问题 Are there callbacks on doze mode (on Doze first/second level, on start/end of maintenance window)? Is there a way to workaround Doze mode that is not dependent on the user approval? In previous versions (Android M and smaller) I used Android Service and partial wake lock to download and process data while the application was in background. Is there a way to download and process data in the background when Android N gets into Doze Mode? 回答1: Are there callbacks on doze mode (on Doze first

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

半腔热情 提交于 2020-01-12 04:00:20
问题 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 similar questions were recommended while writing it. However several team members have spent hours and hours looking through the Android Developer Docs and Stackoverflow and we seem no closer to an answer, so here we are. If I create a reminder and set

Android Nougat PhoneStateListener is not triggered

旧城冷巷雨未停 提交于 2020-01-11 05:26:07
问题 In Android (target 25) I have a background service and in onCreate function I have initialized a phone state listener. It works fine on Android versions that are before Nougat but in Nougat it doesn't work, even though the permissions are granted. public class Service extends IntentService { class PhoneListener extends PhoneStateListener { String TAG = getClass().getName(); @Override public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state,

Doze mode on Oreo

谁都会走 提交于 2020-01-03 03:56:09
问题 I am facing issue in my app regarding doze mode. I am making a chat application and when app is in backgroud during doze mode and receive any message . Device does not show notification in orea. I have followed the proper procedure for OREO notification by building channel for it. I need to find if there is a way to whiteList my app from doze mode so that I can have notifications. Or any other process to optimize notification building. 回答1: I do not need to whitelist my application to get

How to test Doze Mode on Android?

限于喜欢 提交于 2019-12-30 06:37:25
问题 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 everything will work now. To run the application, in the logs I see that both services are running (the basic meaning of the service to read the position of the device, the second service sends the data to the server). Turn off the screen with the command

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

徘徊边缘 提交于 2019-12-30 01:51:05
问题 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 device enters doze mode after being idle for sometime, I no longer receive alarms. However, as soon as I turn On the screen, I receive a notification. My app needs accurate alarms that need to be delivered exactly on-time every 30 minutes! It can