BatteryManager.BATTERY_HEALTH_OVERHEAT:System.out.println ("battery_health_overheat");
Break
Case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:System.out.println ("Battery_health_cold");
Break Case Batterymanager.battery_health_unknowN:system.out.println ("Battery_health_unknown");
Break Case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:System.out.println ("Battery_health_unspecified_failure")
;
Break
Default:break;
}//battery current
1. To obtain the battery information of the Android device, register a BroadCastReceiver whose Action is Intent. ACTION_BATTERY_CHANGED.
2. In the BroadcastReceiver onReceive () event, the received Intent. ACTION_BATTERY_CHANGED includes the following information:
"Present" (boolean )..."Level" (int )... Remaining battery capacity"Scale" (int )... Maximum
The example in this article describes how Android looks at the battery charge. Share to everyone for your reference, specific as follows:
The procedure is as follows:
Import android.app.Activity;
Import Android.app.Dialog;
Import Android.content.BroadcastReceiver;
Import Android.content.Context;
Import android.content.Intent;
Import Android.content.IntentFilter;
Import Android.graphics.Color;
Import A
Battery usage has always been a top concern for smartphone enthusiasts.
As more and more applications increase, people need to charge at least twice a day. This also causes the battery problem to be thrown to the Cusp again. To this end, the android team provided a series of "courses" for its developers to teach some smart phone
Http://hukai.me/android-performance-battery/can refer to this article first1$ adb shell Dumpsys batterystats > Xxx.txt//Get power consumption information for the entire device $ adb shell Dumpsys batterystats > COM.PACKAGE.N Ame > Xxx.txt//Get battery consumption information for the specified app2 Installing Python se
AlarmmanagerElapsed_timeElapsed_time_wakeupRtcRtc_wakeupexpressed using Elapsed_time and RTC. Assume that the device does not wake up and then wait for the device to wake up to run the corresponding actionSo try to use both of these parametersIn addition, the use of Alarmmanager setinexactrepeating is also able to achieve the purpose of power saving, the main difference is how the system to arrange reminders, And
mobile phone battery power, recording the average current of the phone in different scenarios.Test equipment: Monsoon Company's power Monitor TRMT000141Test model: Nexus OneScreen benchmark (CPU goes into hibernation): 7mAAnti-screen wifi:70 MAOff-screen 3G net:270 MADe-screen 2G net gprs:280maBright Screen benchmark:140maBright Screen wi-fi:280maBright Screen 3
to sleep and increase power consumption.
Test method: the hardware device provides a regulated power supply to replace the cell phone battery power supply, and records the average current of the mobile phone in different scenarios.
Test Device: Monsoon's Power Monitor TRMT
Recently, I was wondering how to compile an Android battery plug-in on the desktop. First, this App has practical value, and second, the compilation workload should not be very large, you don't have to spend too much time learning the development method of widgets, so you can do it three times. So you can pause the learning of Game Development and compile a Widget first.
After finding and combining multi
Recent whim, want to make up an Android battery plugin on the desktop, one is this app does have its practical value, the second is to build up the amount of work should not be very large, do not spend too long, three and can learn the development of the widget under the three-way, so, Pause the game development of learning, to make a widget first.
After the search and integration of multiple data finall
Power Management Powermanagerpowermanager is a power management class for Android that manages power operations such as sleep, wake, restart, and adjust screen brightness.The PowerManager object is obtained from the system service Power_service, and its main methods are as follows:Gotosleep: Sleep, that is, lock screen
system broadcast to determine whether the service status is alive, death can be manually killed.2. Use Intentservice instead of service development:Once the normal service is started, it is running and must call the StopService () or Stopself () method to stop the service. In order to simply create an asynchronous, will automatically be worth the service, Android specifically provides a Intentservice class. The intentservice automatically stops after
Great progress space! Android 4.4 power-saving technology details, Android 4.4
Android 4.4In terms of power-saving technology, Google also said it was improved! Let's get to knowAndroid 4.4 power-saving technologyWhat changes have
\android\frameworks\base\services\java\com\android\server\batteryservice.java
mpowersupplyobserver.startobserving ("subsystem=power_supply");//register uevent, monitor power_supply
Uevent and kernel socket communication, a dead loop, the kernel has an event escalation, trigger onuevent
Public
void Onuevent (Ueventobserver.uevent event) {
Synchronized (MLock) {
Updatelocked
1 Power consumption positioning tool and method 1-1 battery information provided by the system 1-1-1 used before Android 4.4 KitKatadb shell dumpsys batteryinfo > d:/batterinfo.logGet the Power log1-1-2 used in Android 4.4 KitKat and later
Get logs
adb shell du
timing of synchronization through settings, trigger synchronization, or turn off synchronization.
API 7 or more.
2. Notes
You can bind an account.
A database that provides contentprovider and synchronizes with the server.
Synchronization is triggered only when there is a network.
2. Trigger synchronization in a certain scenario
As much as possible, pack all the tasks that need to be synchronized in a single cycle to save as much battery
Android Bluetooth Low Energy (Android Low-power Bluetooth)
Android 4.3 (API Level 18) has introduced core functions of Bluetooth Low Energy (BLE, Low-power Bluetooth) and provided relevant APIs through which applications can scan devices and query services, characteristics (
Android 4.3 (API level 18) has started to introduce the core features of Bluetooth low energy (BLE, Bluetooth) and provides APIs that enable applications to scan devices, query services, The characteristics (attribute feature) of the read-write device. Compared to traditional Bluetooth, BLE is designed to significantly reduce power consumption. This makes it possible for low-
mobile phone battery power, recording the average current of the phone in different scenarios.Test equipment: Monsoon Company's power Monitor TRMT000141Test model: Nexus OneScreen benchmark (CPU goes into hibernation): 7mAAnti-screen wifi:70 MAOff-screen 3G net:270 MADe-screen 2G net gprs:280maBright Screen benchmark:140maBright Screen wi-fi:280maBright Screen 3
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.