battery

BroadcastReceiver with a Listener drains battery when not in use

◇◆丶佛笑我妖孽 提交于 2019-12-01 13:03:10
I have a receiver which waits for TelephonyManager.ACTION_PHONE_STATE_CHANGED : public void onReceive(Context context, Intent intent) { String theAction = intent.getAction(); if (theAction != null && theAction.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { CONTEXT = context; startListening(); } When it gets it, I register the listener (for orientation sensor): public void startListening() { sensorManager = (SensorManager) CONTEXT.getSystemService(Context.SENSOR_SERVICE); List<Sensor> sensors = sensorManager.getSensorList(Sensor.TYPE_ORIENTATION); if (sensors.size() > 0) { sensor =

BroadcastReceiver with a Listener drains battery when not in use

半城伤御伤魂 提交于 2019-12-01 11:33:38
问题 I have a receiver which waits for TelephonyManager.ACTION_PHONE_STATE_CHANGED : public void onReceive(Context context, Intent intent) { String theAction = intent.getAction(); if (theAction != null && theAction.equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { CONTEXT = context; startListening(); } When it gets it, I register the listener (for orientation sensor): public void startListening() { sensorManager = (SensorManager) CONTEXT.getSystemService(Context.SENSOR_SERVICE); List<Sensor>

What are the things which reduces (Android) battery time?

百般思念 提交于 2019-12-01 11:31:52
In one of our application we need to use the GPS continuesly ,the purpose is to get the user driving speed. Recently I found that while using the GPS continuesly can drain the device battery. If the GPS device is not used, device battery will work for hours but if the GPS is used it reduces the battery life dramatically. I was wondering that "what are other things" which can reduce the battery time? How we can avoid them ? What are the best practices to use them? Yaqub Ahmad Well i found the answer here, Google I/O 2009 - Coding for Life -- Battery Life, That Is What can I do to increase

Remaining time to battery discharge on android

橙三吉。 提交于 2019-12-01 10:10:06
问题 I am looking for a code for estimating/guessing time remaining before the android phone battery is completely discharged. My search results were full of apps available and also the common comment that it's pretty much useless to calculate it. However i need the code. Any help, even a rough snippet, will do for getting started with. 回答1: You can not accurately guess that how much time is remaining for battery discharge, because there might be different applications or service consuming battery

Battery historian cannot find end time android

流过昼夜 提交于 2019-12-01 08:19:15
I'm trying to use Battery Historian Python script from GitHub to analyze battery usage, but the html generated each time I use the script shows "cannot find end time". I'm following the steps form here . Here is a sample batterystats.txt file generated: Battery History: -2m43s770ms 100 44020302 status=not-charging health=good plug=none temp=270 volt=4339 +wifi +wifi_running +wake_lock brightness=medium phone_state=off -2m43s151ms 100 44020302 -2m38s500ms 100 04020302 -wake_lock -2m20s496ms 100 44020302 +wake_lock -2m17s471ms 100 04020302 -wake_lock -2m13s741ms 100 04020302 temp=280 -1m59s447ms

What are the things which reduces (Android) battery time?

谁都会走 提交于 2019-12-01 08:09:16
问题 In one of our application we need to use the GPS continuesly ,the purpose is to get the user driving speed. Recently I found that while using the GPS continuesly can drain the device battery. If the GPS device is not used, device battery will work for hours but if the GPS is used it reduces the battery life dramatically. I was wondering that "what are other things" which can reduce the battery time? How we can avoid them ? What are the best practices to use them? 回答1: Well i found the answer

Battery historian cannot find end time android

笑着哭i 提交于 2019-12-01 07:10:32
问题 I'm trying to use Battery Historian Python script from GitHub to analyze battery usage, but the html generated each time I use the script shows "cannot find end time". I'm following the steps form here. Here is a sample batterystats.txt file generated: Battery History: -2m43s770ms 100 44020302 status=not-charging health=good plug=none temp=270 volt=4339 +wifi +wifi_running +wake_lock brightness=medium phone_state=off -2m43s151ms 100 44020302 -2m38s500ms 100 04020302 -wake_lock -2m20s496ms 100

How to obtain extensive battery info in iOS?

北慕城南 提交于 2019-12-01 06:53:18
I'm wondering is it possible to receive information about battery like: capacity (mA), voltage (V), cycle count within iOS? I know UIDevice class, but battery level is not what I'm looking for. I might be wrong about this but using public APIs this is not possible. According to the UIDevice documentation, it appears the most you can do is get the battery charge level, its state, and enable battery monitoring. Update 15th Feb 2019: Looks like iOS UIDevice API's now allow developers to get access to battery charge level for the device. Whooo! It currently exposes 4 different API's. By the looks

Obtaining usb cable plugged IN/OUT event using EXTRA_PLUGGED does not work

给你一囗甜甜゛ 提交于 2019-12-01 05:22:22
My intention is to have saved in Preferences current status of Android device usb/power cable: connected/disconnected. From Developer site I see that there are two Intent for obtaining that status: ACTION_POWER_CONNECTED / DISCONNECTED. So I used same code as published at Developers: http://developer.android.com/training/monitoring-device-state/battery-monitoring.html in section Monitor Changes in Charging State. Manifest <receiver android:name=".PowerConnectionReceiver"> <intent-filter> <action android:name="android.intent.action.ACTION_POWER_CONNECTED"/> <action android:name="android.intent

How to obtain extensive battery info in iOS?

主宰稳场 提交于 2019-12-01 04:54:12
问题 I'm wondering is it possible to receive information about battery like: capacity (mA), voltage (V), cycle count within iOS? I know UIDevice class, but battery level is not what I'm looking for. 回答1: I might be wrong about this but using public APIs this is not possible. According to the UIDevice documentation, it appears the most you can do is get the battery charge level, its state, and enable battery monitoring. Update 15th Feb 2019: Looks like iOS UIDevice API's now allow developers to get