5

I have a requirement to create an app that should run 24/7. I don't care about battery drain, becoz app will not be submitted to PlayStore and its only for the selected user.I also understand app will only last for one day, that is acceptable in my case.

The application functionality mainly dependent on network and Bluetooth functionality and the most of the code written in pre marshmallow and changing the whole implementation is not a right option for me now.

So is there any way to create the app without any restriction? Also, As observed some of the Device manufacturers put an extra layer of battery optimization to make this worse.

I tried to create a dummy foreground service with partial wakelock, but this not seems to be working. and even whitelisting the app didn't solve the issue.

There is no proper documentation from Google about what are the functionalities will be affected from doze/standby. According to Google doc the background task will not be suspended, it only deferred until the next maintenance window. If that is the case, App should be able to print all the app that is missed during doze period. But as observed app will print the log only during the maintenance window. The is will break the expected behavior.

Whitelisting is a good option but app will be still be affected by the doze mode. What is the reason to restrict the app behavior even when the user explicitly chose not to? It very frustrating when the app behaves differently in different device OS, Manufacturer etc.

Sorry for the story. I would like to understand is there any way to completely disable Doze and standby mode without changing the existing implementation? I have gone through the various document, but there is NO WAY to achieve this 100%. Please share your thoughts

Jess
  • 85
  • 1
  • 8

1 Answers1

4

I have a requirement to create an app that should run 24/7

Write a program for a desktop operating system. Or, perhaps find a mobile device that runs Linux and write a program for it. Or, create a custom version of Android that disables Doze/app standby. Or, see if there is some Android hardware that meets your requirements and does not apply Doze/app standby (e.g., devices that naturally are always plugged in, such as Android TV or a Chromebox).

So is there any way to create the app without any restriction?

No, sorry.

I would like to understand is there any way to completely disable Doze and standby mode without changing the existing implementation?

No, sorry.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 1
    Thanks for the confirmation.I totally agree if its an Android design decision. – Jess May 01 '18 at 10:56
  • But I still wonder why Google is not considering pre-marshmallow implementation and app that is not updated ever since. I don't see a valid purpose for Google to put a restriction on the whitelisted app when the user is explicitly fine with the battery drain. Is it too much to ask? I don't see any security or other concerns here. Also, I feel it's a valid scenario to keep my app running for around 15 to 20 hours a day and allow to drain the battery and use the remaining time(4 to 6 hours) for charging. – Jess May 01 '18 at 11:24
  • Is any approach to support "working" mode for GPS tracking Android service? I mean does Doze affect the Android service getting location every 10 seconds and send via htpp the coords dataset? – NoWar May 07 '19 at 04:51
  • 1
    @Developer: Doze mode and app standby affect all apps, including those that use GPS. In fact, there are even more restrictions on apps using GPS (see changes in Android Q, for example). The best that you can do is use a foreground service and ask the user to opt out of any battery optimizations for your app. – CommonsWare May 07 '19 at 10:55
  • I understand that the app shouldn't be able to disable doze, but shouldn't the owner (human) of the phone be able to configure & tune all of the power saving settings to their liking?? – Michael Altfield Sep 25 '21 at 15:49
  • @MichaelAltfield: In principle, yes. My assumption is that the concern is usability, wanting to avoid some complex Settings UI for that sort of tuning. Also bear in mind that manufacturers were already starting to do aggressive things to help deal with power management, and I suspect that one of Google's objectives was to try to have more consistency in that area between devices. In truth, I do not know if they really succeeded there. – CommonsWare Sep 25 '21 at 16:28