MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Developing Energy-Efficient Apps: 7 Helpful Guidelines

Published on 08 October 13
211
0
1

Battery life is one of the biggest drawbacks of owning a smartphone. All too often, you'll hear of people complaining that their battery died too quickly. Rather than blaming the battery, they should be blaming the app. Apps have a tendency to run in the background and constantly check for new information, which completely kills the battery. Here are a few helpful guidelines for making your app a little more energy-efficient.


Schedule Background Data Syncs


One of the biggest battery drainers is background data syncs. By scheduling your background data syncs, you can reduce power consumption and network traffic. If you want, you can sync your app's network activity requests with network activities from other apps, which will reduce both network traffic and power consumption.

You should use AlarmManager with setInexactRepeat along with an interval constant, such as INTERVAL_HALF_HOUR. This will make sure your intents are sent every 30 minutes without specifying when within that interval the intents are set. Also, make sure to use AlarmManager.RTC and not AlarmManager.RTC_WAKEUP. By doing this, you're ensuring that the application won't be woken up unless another app is woken up.

Another suggestion is to do the syncs nightly. Since it'll likely use a large amount of data on the network, it would make sense to do the update overnight. In some states people have the power to choose their electric provider, so by scheduling a background data sync overnight, you're likely going to save the user some money since their phone will already be plugged in at an ideal energy time and they won't have to waste the energy to recharge it.


Use Push Notifications


Push notifications are much better than having apps checking the server periodically since data is pushed to the device once the data is available. Google Cloud Messaging is a great method to use since it provides a simple program to handle every aspect of pushing new data from the server to your application. It's compatible with Android 2.2 and later.


Increase App Speed with Caching


By caching information, it makes the network applications appear to be faster, because it uses the most effective means of data storage and transfer. The purpose of caching is to reduce the number of round-trips your app makes to a server through an expiration mechanism. It also reduces network bandwidth through a validation system. These systems make it possible for a client and server to control when an application can use cached content, and when the application needs to download new data.

Caching is essential for network applications to reduce network traffic. APIs are used to support HTTP caching in Android web browsers. These APIs aren't available to other applications, so you're on your own for implementing caching support.


Compress HTTP requests


If your app uses HTTP, it should support compression. Compression reduces the size of HTTP entity bodies, which improves the experience for the user by loading data faster. For XML and JSON, the reduction size can be as high as 80 percent. For Android operating systems, there's qzip and DEFLATE support for compression of HTTP content. This means that it'll take less time to download HTTP data to your app.

To utilize these compressions, you'll need to add the "Accept-Encoding" header in the request that your app sends. The received content needs to be handled based on its "Content-Encoding" header.

Use Asynchronous Requests

With apps for smartphones, there's always a chance of requests being delayed because it's being sent over a mobile network. To combat this, you should prepare to have your app deliver at least some data to the user, even if the rest of the data isn't available. By doing this, your app will be much faster for the user.


Don't Let the App Launch on its Own


This is more of a problem for apps designed for the Android operating system than iOS. Some apps on Android run without the user's permission or reboot after they've been closed. They also open when the device powers on. Make sure that your app doesn't do any of that. This also speaks to UEX issues: Users get annoyed when an app refuses to close or opens without them asking it to, leading to users deleting your app.


Disable Bloated Functions


Some of the best features of smartphones are also the ones that drain the battery the most. Make sure that your app isn't using the GPS or any location function, the camera, the accelerometer, or any other sensors. Many apps that utilize these functions don't turn them off after they're done, leaving the user confused and frustrated when their battery is 10 percent less than what it was twenty or so minutes ago.

Another thing to watch out for is advertising networks. Some apps, such as the New York Times and Angry Birds, use the Flurry advertising network, which serves rich-media ads. This leads to apps using 25 to 35 percent of their energy on actual content and functionality, while 65 to 75 percent is reserved for user tracking.

Using these tips, go forth and develop your app in an energy-efficient manner; not only will you be doing your own little part for the planet, but you'll be helping your users save a little cash too. And you never know, your idea could be the next big hit!












Battery life is one of the biggest drawbacks of owning a smartphone. All too often, you'll hear of people complaining that their battery died too quickly. Rather than blaming the battery, they should be blaming the app. Apps have a tendency to run in the background and constantly check for new information, which completely kills the battery. Here are a few helpful guidelines for making your app a little more energy-efficient.

Schedule Background Data Syncs

One of the biggest battery drainers is background data syncs. By scheduling your background data syncs, you can reduce power consumption and network traffic. If you want, you can sync your app's network activity requests with network activities from other apps, which will reduce both network traffic and power consumption.

You should use AlarmManager with setInexactRepeat along with an interval constant, such as INTERVAL_HALF_HOUR. This will make sure your intents are sent every 30 minutes without specifying when within that interval the intents are set. Also, make sure to use AlarmManager.RTC and not AlarmManager.RTC_WAKEUP. By doing this, you're ensuring that the application won't be woken up unless another app is woken up.

Another suggestion is to do the syncs nightly. Since it'll likely use a large amount of data on the network, it would make sense to do the update overnight. In some states people have the power to choose their electric provider, so by scheduling a background data sync overnight, you're likely going to save the user some money since their phone will already be plugged in at an ideal energy time and they won't have to waste the energy to recharge it.

Use Push Notifications




Push notifications are much better than having apps checking the server periodically since data is pushed to the device once the data is available. Google Cloud Messaging is a great method to use since it provides a simple program to handle every aspect of pushing new data from the server to your application. It's compatible with Android 2.2 and later.

Increase App Speed with Caching




By caching information, it makes the network applications appear to be faster, because it uses the most effective means of data storage and transfer. The purpose of caching is to reduce the number of round-trips your app makes to a server through an expiration mechanism. It also reduces network bandwidth through a validation system. These systems make it possible for a client and server to control when an application can use cached content, and when the application needs to download new data.

Caching is essential for network applications to reduce network traffic. APIs are used to support HTTP caching in Android web browsers. These APIs aren't available to other applications, so you're on your own for implementing caching support.

Compress HTTP requests




If your app uses HTTP, it should support compression. Compression reduces the size of HTTP entity bodies, which improves the experience for the user by loading data faster. For XML and JSON, the reduction size can be as high as 80 percent. For Android operating systems, there's qzip and DEFLATE support for compression of HTTP content. This means that it'll take less time to download HTTP data to your app.

To utilize these compressions, you'll need to add the "Accept-Encoding" header in the request that your app sends. The received content needs to be handled based on its "Content-Encoding" header.

Use Asynchronous Requests

With apps for smartphones, there's always a chance of requests being delayed because it's being sent over a mobile network. To combat this, you should prepare to have your app deliver at least some data to the user, even if the rest of the data isn't available. By doing this, your app will be much faster for the user.

Don't Let the App Launch on its Own




This is more of a problem for apps designed for the Android operating system than iOS. Some apps on Android run without the user's permission or reboot after they've been closed. They also open when the device powers on. Make sure that your app doesn't do any of that. This also speaks to UEX issues: Users get annoyed when an app refuses to close or opens without them asking it to, leading to users deleting your app.

Disable Bloated Functions




Some of the best features of smartphones are also the ones that drain the battery the most. Make sure that your app isn't using the GPS or any location function, the camera, the accelerometer, or any other sensors. Many apps that utilize these functions don't turn them off after they're done, leaving the user confused and frustrated when their battery is 10 percent less than what it was twenty or so minutes ago.

Another thing to watch out for is advertising networks. Some apps, such as the New York Times and Angry Birds, use the Flurry advertising network, which serves rich-media ads. This leads to apps using 25 to 35 percent of their energy on actual content and functionality, while 65 to 75 percent is reserved for user tracking.

Using these tips, go forth and develop your app in an energy-efficient manner; not only will you be doing your own little part for the planet, but you'll be helping your users save a little cash too. And you never know, your idea could be the next big hit!

This blog is listed under Development & Implementations and Mobility Community

Related Posts:
Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top