How to optimize power

Source: Internet
Author: User

We can see that the factors that affect the power are the CPU time and network data and the use of WAKELOCK,GPS.
This issue was explored in the 09 Google IO Conference Jeffrey Sharkey's Speech (Coding for life-battery life, which is), pointing out that the power consumption of Android applications is mainly in the following three areas:
The transmission of large amounts of data.
Constantly switching between 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: Recycling Java objects, especially the larger Java pair, using the Reset method, not too high positioning requirements, try not to use GPS positioning, you may use WiFi and mobile network cell location, try not to use floating point arithmetic, get screen size and other information can use the caching technology, There is no need to make multiple requests; Use Alarmmanager to start the service on a timed basis instead of a timed task that uses sleep.

How to optimize power

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.