speech at the 09 Google IO Conference Jeffrey Sharkey (Coding for Life-battery life, which is)
Discusses this problem, pointing out that the power consumption of Android applications is mainly in the following three areas:
The transmission of large amounts of data.
Keep switching between the networks .
Parse a large amount of text data.
And put forward the related optimization suggestions:
In a program that requires network connectivity, first check that the network connection is normal, and if you do not have a network connection, you do not need to perform the appropriate program.
Using highly efficient data formats and parsing methods, JSON and PROTOBUF are recommended.
When downloading large amounts of data, try to download it using the Gzip method.
Other: Recycle Java objects, especially large Java pairs, using the Reset method, not too high on the positioning requirements, try not to use GPS positioning,
may use WiFi and mobile network cell location, try not to use floating point arithmetic, get screen size and other information can use caching technology, do not need to make multiple requests;
Use Alarmmanager to periodically start a service instead of a timed task that uses sleep mode.
As an app developer, few people will notice the app's power loss, but the user is very sensitive to battery power, and the app will optimize its power consumption to add a lot to its app.
If a good responsible developer, you should limit the impact of the app on the power, when there is no network connection, disable background service updates,
Reduce the frequency of updates when the battery is low and make sure your app has minimal impact on the battery.
Maximize app refresh rate when battery is charged or power is saturated
The more times the CPU wakes up, the greater the power consumption. Many applications now register alarm services in order to maintain heartbeat, pull data, and actively push
Causes the Android system to wake up frequently.
That's why Lei June says that when Android phones are installed with TOP100 applications, the standby time can be significantly shortened.
Rabbit--android charge