power-management

how to register broadcast receiver for low battery in android?

半腔热情 提交于 2019-12-06 13:49:46
I want to register broadcast for low battery. If battery status reached at some level I want to get alert... Please if you have any idea please help me.. You will need to register a BroadcastReceiver for ACTION_BATTERY_LOW . You can do this in the manifest with a <receiver> element or via registerReceiver() from some already-running component of your application. For Battery_Status_Low, You could try registering it through a Service for example, like: BatteryReceiver receiver = new BatteryReceiver(); IntentFilter inf = new IntentFilter(); inf.addAction("android.intent.action.BATTERY_LOW");`

Get Battery Info without WMI

吃可爱长大的小学妹 提交于 2019-12-06 10:06:11
Is there some way to obtain the battery DesignCapacity and FullChargeCpacity without WMI ? This values are not supported in WMI so I need to find other way to get them. Or maybe somebody have better (easier) idea to get the wear level of battery in C#? BTW I try to use it this way but just returned null ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT DesignCapacity FROM Win32_Battery"); foreach (ManagementObject queryObj in query.Get()) { string dc = Convert.ToString(queryObj.GetPropertyValue("DesignCapacity")); label1.Text = dc + " mAh"; } Thanks To get those particular

Recognize volume button presses when screen is off Android

霸气de小男生 提交于 2019-12-06 07:18:05
问题 I am trying to recognize when the user presses the volume rockers when the screen is off to update an activity. From what I've read, BroadcastReceivers (I think) don't work when the phone is asleep, and so the only way to do this is to keep the activity running using a PARTIAL_WAKE_LOCK. My app is a basic one that shouldn't use too much battery, but I'm concerned that using a PARTIAL_WAKE_LOCK might drain the battery (which defies the purpose of recognizing button presses when the screen is

how can i set the value of Minimum (Maximum) Processor state

喜你入骨 提交于 2019-12-06 05:58:40
Under Win7, open Control Panel -> Power Options -> Advanced Settings->Processor power management. you can see Minimum Processor state, Maximum Processor state. I have get the value by powercfg command using C#. Now,I want to set the value of Processor state by C#. For example the old value is 5%,execute the programe,update the value to 10%. I have search the powercfg help document,there are no such command to do this. How can I achieve this? I could only recommend calling WriteProcessorPwrScheme using PInvoke. Windows API Code Pack for .NET has some power management functions but probably not

Android Static Variable Scope and Lifetime

笑着哭i 提交于 2019-12-05 12:41:19
I have an application that has a Service that uses an ArrayList<Double> to store numbers in the background for a very long time; the variable is initialized when the service started. The service is in the background, and there will be frequent access to the variable (that's why I don't want to use file management or settings -- it will be very expensive for a file I/O for the sake of battery life). The variable will likely be ~1MB->2MB over its lifetime. Is it safe to say that the variable will never be nulled by GC or the system, or is there any way to prevent it? CommonsWare I have an

iPhone4 iOS5 battery level monitoring do I need to add setBatteryMonitoringEnabled:NO to periodic battery checks?

强颜欢笑 提交于 2019-12-05 02:42:34
问题 I'm running an app that samples accelerometer and gyroscope data overnight. This is a very battery intensive operation, and I would like to teach my app to recognize when the battery is getting low. Here's my prototype code, which checks the battery level every 10 minutes NSDate* date = [NSDate date]; if((int)([date timeIntervalSinceReferenceDate])%600 == 0) { UIDevice *myDevice = [UIDevice currentDevice]; [myDevice setBatteryMonitoringEnabled:YES]; float batLeft = [myDevice batteryLevel];

Off screen rendering when laptop shuts screen down?

一曲冷凌霜 提交于 2019-12-05 01:14:32
I have a lengthy number-crunching process which takes advantage of quite abit of OpenGL off-screen rendering. It all works well but when I leave it to work on its own while I go make a sandwich I would usually find that it crashed while I was away. I was able to determine that the crash occurs very close to the moment The laptop I'm using decides to turn off the screen to conserve energy. The crash itself is well inside the NVIDIA dlls so there is no hope to know what's going on. The obvious solution is to turn off the power management feature that turns the screen and video card off but I'm

android Power Management, Sleep mode, etc [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-04 16:59:16
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I have difficulty in understanding power management best practices and sleep mode state of android device. Sleep mode. 1.1) when will this happen? 1.2) CPU is going to sleep and my threads are suspend? and when will this happen? 1.3) To prevent CPU sleeping I can use PARTIAL_WAKE wake lock or alarm manager? What the best for battery? 1.4) How prevent shutdown of WiFi and 3G connection in sleep mode

iPhone4 how to find out if the power cable is plugged in?

こ雲淡風輕ζ 提交于 2019-12-04 13:34:25
问题 I would like to know if my app is running with an external power cable attached. Is it possible to find out this state at runtime? An extra question: would this be able to differentiate between true USB power and those external "battery packs"? Thank you! 回答1: Use UIDevice property batteryState : [[UIDevice currentDevice] batteryState] == UIDeviceBatteryStateCharging From UIDevice Docs: typedef enum { UIDeviceBatteryStateUnknown, UIDeviceBatteryStateUnplugged, UIDeviceBatteryStateCharging,

Is it possible to detect Power Nap / DarkWake mode in OSX

这一生的挚爱 提交于 2019-12-04 06:37:25
I have a daemon process started via launchd. This will be running even during DarkWake and has no time to finish before OS X goes back to sleep again. I can think of the following solutions, but didn't find a way to achieve this. Don't make this daemon process run during DarkWake. I went through Apple documentation and forums but didn't find any reference for this. During DarkWake via daemon process make the OS wait until its done. Tried with calling pmset noidle and caffeinate in daemon process. It didn't work. OS X went to sleep. It seems OS X suppresses the delivery of many notifications