battery

How to analyise battery usage of android application and optimize it?

南楼画角 提交于 2019-12-23 19:09:30
问题 I would like to analyze battery usage of my application, I mean the parts of the app, such as broadcastreceivers, listeners, services, etc.., how much battery uses. I need a detailed list, and from the list, I would like to optimize battery usage. Method would be similar than using Memory Analyzer (http://android-developers.blogspot.hu/2011/03/memory-analysis-for-android.html) Is there any tool for it? I used some battery tracking app from PlayStore, but global battery usage of application is

Why is my Receiver for charging status always returning false?

你离开我真会死。 提交于 2019-12-23 13:19:10
问题 I'm trying to detect when a user plugs (or unplugs) in their device to charge. In my receiver, where I determine whether it is plugged in or not, I always get a "false" reading on the status. Here is my code: (In the manifest): <receiver android:name=".PowerConnectionReceiver" > <intent-filter> <action android:name="android.intent.action.ACTION_POWER_CONNECTED" /> <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" /> </intent-filter> </receiver> Here is the

Battery consumption while TCP is open for ADB via wifi can connect

。_饼干妹妹 提交于 2019-12-23 10:00:05
问题 My question is related to ADB over Wifi. I've found an article: http://stuffandtech.blogspot.de/2012/03/android-quick-tip-adb-over-wifi.html and that works for me, but I would like to know if keeping TCP open all the time actually will cause any significant battery drain. Of course I am talking about opened, but not used. After some time connection seems to die by timeout: device, that used to be connected remotely #adb devices List of devices attached 192.168.2.2:5555 device disappears from

Android WifiManager and Scanning Battery Performance

僤鯓⒐⒋嵵緔 提交于 2019-12-23 08:25:14
问题 To my understanding, one can request the WifiManager to start an AP scan, which is great and you get scan results back, but my question is regarding the continuous wifi scan that happens under the hood. Aside from unregistering the wifi listener for scan callback, is disabling the wifi the only way to stop the hardware from scanning? So if my device is connected to some Wifi BSSID/SSID it's ALSO constantly scanning? (Yes http://www.androidauthority.com/community/threads/how-to-get-wifi-to

ContentObserver vs. BroadCastReceiver : Battery Usage, Ram, CPU?

三世轮回 提交于 2019-12-22 08:47:24
问题 Since there is such a needed concern for an application's battery usage, ram and cpu usage, what is the expense of multiple contentobservers vs. multiple broadcastreceivers? Example 1: A service running with START_STICKY using 5 contentobservers registered/unregistered properly. Example 2: A service being fired from 5 broadcastreceivers set in the manifest. Example 3: A service running with START_STICKY using 5 registered broadcastreceivers. What is the true difference in battery usage/ram

How to find the battery recharge time of android mobile programatically?

时光怂恿深爱的人放手 提交于 2019-12-22 08:14:18
问题 I wanted to know that how can we find how much time android device will take to fully charge its battery. For example if my battery is 0% charged then how long it will take to charge full i.e. 100%, same if my device is 70% charge so if i connect charger now then how long it will take to full charge my device. 回答1: You should read the official documentation about this. Basically you'll need to use BatteryManager class to find out current state of battery level. 回答2: This worked for me:

Creating a ChargeInhibit Assertion (OS X 10.6.8)

一世执手 提交于 2019-12-21 22:04:05
问题 Platform (OS X 10.6.8) - [Macbook Pro - this is important as I want to deal with the battery handling - not applicable for a desktop] Forgive me if I've made a basic mistake that I don't see, as I haven't written any C/C++ in five years or more, and I'm not fully following the way apple APIs want you to deal with them, so this is what my question regards. Basically, I want to be able to inhibit charging from the AC adaptor at my command, so that I can choose whether to charge my laptop or not

How can I programmatically stop a notebook battery from charging

穿精又带淫゛_ 提交于 2019-12-21 04:04:23
问题 There is some easily available information on finding the status of a battery, or weather it's charging or not. (GetSystemPowerStatus API or System.Windows.Forms.SystemInformation.PowerStatus). I want to be able to stop a battery from charging based on some criteria, e.g. battery power > 20%. Is there an API to do this? 回答1: I think it's impossible, because you have need some API for battery or battery charger. And this API can provide to you manufacturer of notebook and battery or battery

PubNub long polling vs sockets - mobile battery life

旧街凉风 提交于 2019-12-20 10:33:50
问题 I recently began using PubNub in my iOS app, and am very happy with it. However, I have been looking at the other options available, such as Pusher and Realtime.co, which use Websockets. PubNub, on the other hand, uses long polling. I have done my own little speed comparisons and for my purposes, I find that they are all fast enough. PubNub offers some nice features like message history and a list of everyone in the channel , so barring everything else I am leaning toward them. My question is

How to get battery percentage with python? [duplicate]

自闭症网瘾萝莉.ら 提交于 2019-12-19 03:45:37
问题 This question already has answers here : Getting Battery Capacity Windows with Python (2 answers) Closed 2 years ago . How to get battery percentage with python? Maybe some win32api functions may help. 回答1: Try this: import psutil battery = psutil.sensors_battery() plugged = battery.power_plugged percent = str(battery.percent) if plugged==False: plugged="Not Plugged In" else: plugged="Plugged In" print(percent+'% | '+plugged) Library link is here. And check out this 来源: https://stackoverflow