I read many questions here about doze mode like Android doze mode, Android N Doze mode - how to keep background download and processing?, Wakelock and doze mode and many others. But in many replies, opinions is different. I can't test it by myself (emulator does not support my processor, and my only test device is android 5.1). I would like to know the next situation. I have an activity, which controls the media player. On devices with android 6.0 and higher it wouldn't work as expected cause of doze mode. As many solutions says to prevent doze mode it should start a service in separate process in foreground and control media player from there. The question is: if i start foreground service with partial wake lock in separate process, which would do nothing except showing notification, and leave controls to media player in my activity, should it prevent the doze mode? Or maybe there any other ways except keep the screen on from window manager?
Android doze mode and foreground service
2.1k Views Asked by kara4k At
1
There are 1 best solutions below
Related Questions in ANDROID
- When function should be effectful?
- 'No type class instance was found' on multi-parameter type class
- Does PureScript have a pipe operator?
- Using # with Either types in PureScript
- How do I collapse an Either in PureScript?
- How to capture output of a child process in purescript?
- Is it possible to run something in Eff in a halogen ComponentHTML funcion?
- Duplicate row error, how to unify generic row types
- How is the newline, tab characters represented in purescript?
- Accessing the row variable within the function
Related Questions in WAKELOCK
- When function should be effectful?
- 'No type class instance was found' on multi-parameter type class
- Does PureScript have a pipe operator?
- Using # with Either types in PureScript
- How do I collapse an Either in PureScript?
- How to capture output of a child process in purescript?
- Is it possible to run something in Eff in a halogen ComponentHTML funcion?
- Duplicate row error, how to unify generic row types
- How is the newline, tab characters represented in purescript?
- Accessing the row variable within the function
Related Questions in FOREGROUND-SERVICE
- When function should be effectful?
- 'No type class instance was found' on multi-parameter type class
- Does PureScript have a pipe operator?
- Using # with Either types in PureScript
- How do I collapse an Either in PureScript?
- How to capture output of a child process in purescript?
- Is it possible to run something in Eff in a halogen ComponentHTML funcion?
- Duplicate row error, how to unify generic row types
- How is the newline, tab characters represented in purescript?
- Accessing the row variable within the function
Related Questions in DOZE
- When function should be effectful?
- 'No type class instance was found' on multi-parameter type class
- Does PureScript have a pipe operator?
- Using # with Either types in PureScript
- How do I collapse an Either in PureScript?
- How to capture output of a child process in purescript?
- Is it possible to run something in Eff in a halogen ComponentHTML funcion?
- Duplicate row error, how to unify generic row types
- How is the newline, tab characters represented in purescript?
- Accessing the row variable within the function
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
According to this SO question and answer:
- Source (sec_aw)
It looks like using a foreground service prevents the app from being killed by Doze.
Please note though, that some vendors (I know of Samsung, but there are probably others) create their own RAM conservation/battery saving tools. These may exhibit patterns completely different from Doze, and there's usually a bunch of other hoops to jump through. You are not guaranteed to get the same behavior on these devices either - they may be more or less aggressive, and the more aggressive ones tend to be worse for keeping services or whatever alive.
There's also no universal way to deal with these, but someone has made an entire website dedicated to showing what vendors are problematic, as well as potential workarounds. Note that the majority of the problematic vendors only yield end-user solutions, which means you (the developer) have no way to fix it without the user doing something.
While this is unfortunate, that's pretty much what happens when companies implement their own versions of Android. Also, from my own experience (primarily as a user rather than a dev) on a Samsung phone, the settings aren't always respected and still causes annoying behavior.
Anyway, as long as Doze is present, foreground services should be fine. On other vendors, however, all bets are off and you're at the mercy of the vendor's implementation of some type of optimization system. On certain exposed operating systems (again, see the website linked earlier), you also have no choice but to ask the user to fix certain settings to keep stuff alive.