Android app development power consumption control.

Source: Internet
Author: User

The more modules The program starts, the faster it consumes power.

When you run a program that consumes only the CPU, the power consumption is minimal.

Of course, this is the best if the CPU is running slowly.

The program power consumption control first from the following 3 aspects of grasping:

1. Frequent I/O operations (starting local external enclosures and network communication modules)

2. Run too many threads at the same time (CPU module).

3. Frequent memory allocations and resulting memory fragmentation (frequent use of memory modules)

Reduce I/O operations:

If you are not connected to the WiFi or there is no available network, if not meet the conditions, do not start the network communication.

Use compression to reduce the data transferred in the network.

When reading and writing local text, you should choose a high-quality method implementation to reduce the read and write operations of external storage.

Use the appropriate cache to reduce I/O operations.

Run too many threads at the same time:

Not to million, do not easily go to the operation.

When you need to perform timed tasks, we recommend that we use Alarmmanager to start the service on a timed basis.

Alarmmanager is the use of hard wake technology when the target time is not reached and he is in hibernation

State.

Frequent memory allocations and the resulting memory fragmentation:

Singleton mode is recommended when an object needs to be used frequently in different modules.

Caching techniques are recommended when allocating memory frequently.

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.