battery-saver

How force the app to opt out of battery saver mode when the service is ON?

怎甘沉沦 提交于 2021-02-05 05:56:06
问题 The expected behavior is that the app will be running all the time when it's in ON state. Some phones put the app in background mode when the app is not active for some time. I want the app to be running all the time even its in standby mode(standby mode means when we press the home button the app will go to background. and it will run for some time). I found following code and I tried that PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);

Foreground service is killed in Android 10

醉酒当歌 提交于 2020-06-17 13:13:05
问题 In Android 10, some manufacturer comes with the new feature in a battery optimization setting (see the picture). My foreground service getting killed by OS after some time when the screen is off. I have used the foreground service with notification. This code is working well when the screen is ON in all devices. I am facing this issue in OnePlus and realMe device, both having an android 10 OS. I want to know, Is there any way to solve this problem? Is there any way to know in my device is

Retrieve state of Windows 10 Power mode slider

耗尽温柔 提交于 2020-06-10 03:42:31
问题 Is there any API to retrieve a state of Windows 10 Power mode slider? I was looking at Windows.System.Power namespace. But PowerManager class seem to provide only an immediate state of the power system, but not user preferences set by the slider. The slider also exists somehow in parallel with previous "power plan" settings. It does not seem that the slider state is reflected directly in Win32_PowerPlan. 回答1: Change the position of the slider, and the registry key: HKLM\SYSTEM\ControlSet001

Power saving mode in Android controlled programmatically?

南笙酒味 提交于 2019-12-20 05:22:12
问题 Is it possible to turn ON/OFF power saving mode from code? For the time being, I do wakelock acquire and release, but I assume, that is not the same. 回答1: There aren't any publicly available API's to do this in the SDK. You can use the PowerManager to acquire and release wakelocks but that's about it. Besides, every manufacturer and device might have it's own version of what it means by "power saving mode", so it doesn't make sense to give 3rd party app developers an API to interact with the

Background agent doesn't run when battery saver mode is on

早过忘川 提交于 2019-12-11 12:11:42
问题 I'm using a PeriodicTask that works flawlessly, but it doesn't run if the battery saver mode is on, even though I've allowed the app to run in the background in this state via the Battery Saver app. Any ideas what may be causing it from not running? I should add that I'm generating a new front and back live tile image using Telerik's LiveTileHelper control inside the background agent, and that a http request is made too (the app is a weather app). This is for a Silverlight Windows Phone 8 app

Progressbar disappears in battery saver mode (Android 5.x)?

那年仲夏 提交于 2019-12-10 20:29:05
问题 I noticed that when the Battery saver mode is enabled (by the user or automatically) in Android 5.x - ProgressBars in application just disappear. No animation, no static progressbar widget - just empty place. How to prevent that? I understand when Battery saver disables some system animations, but progressbars is actually an important part of the application UI. Just in case - code that implements ProgressBar Layout: <ProgressBar style="?android:attr/progressBarStyleHorizontal" android:layout

IOS9 Push Battery Saver Mode - didReceiveRemoteNotification not called

馋奶兔 提交于 2019-12-02 05:18:02
On IOS9 if an iPhone is in battery save mode, the callback application:didReceiveRemoteNotification:fetchCompletionHandler: is not called. Instead I get the following warning in the console High Priority Push: com.your-company.app - Battery Saver Mode Enabled When using PushKit it does seem to work. Does anybody else experience this behaviour? Any other workarounds? I believe, unfortunately, that this is the intended behavior. The documentation about push notifications constantly hedges their reliability. E.g.: https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual

Get location (coordinates) periodically without dramatically increase battery consumption

江枫思渺然 提交于 2019-12-01 04:43:45
I'm developing an Android application; this App needs to send periodically (every 10 minutes) the current position (coordenates) to a web service. But ... I'm a little confused about the more correct way (and friendlier to the device battery) to do that. I read this answer and her method _getLocation() looks well; but I don't know whether that method could get the availability of the location I need; total availability... I would like, if the location is not available using GSM / WIFI, application choose the GPS method. Is that what makes this method? private void _getLocation() { // Get the

Get location (coordinates) periodically without dramatically increase battery consumption

牧云@^-^@ 提交于 2019-12-01 02:29:58
问题 I'm developing an Android application; this App needs to send periodically (every 10 minutes) the current position (coordenates) to a web service. But ... I'm a little confused about the more correct way (and friendlier to the device battery) to do that. I read this answer and her method _getLocation() looks well; but I don't know whether that method could get the availability of the location I need; total availability... I would like, if the location is not available using GSM / WIFI,

Programmatically enable/disable “Battery Saver” mode

馋奶兔 提交于 2019-11-29 12:14:33
问题 I am trying to find if I can enable and/or disable Android's built-in "Battery Saver" mode programmatically. Any official approaches, or trickery, are welcome. For reference, here is how to do it following Android's standard UI in 5.0: http://www.androidcentral.com/android-50-lollipop-basics-how-get-more-life-between-charges-battery-saver I am aware you can detect it -- that is not what I am after. Thanks all. 回答1: You can enable/disable Battery Saver programmatically on rooted devices. You