⇓ More from ICTworks

6 Ways to Be Data Efficient When Developing Mobile Apps for African ICT4D Projects

By Guest Writer on September 5, 2018

africa data mobile application

Here is what I’ve learned about being data efficient when developing mobile phone applications. The first and foremost thing, is to please the user by reducing as much as possible the amount of data our mobile apps use and the battery drain they inflict on our mobile phones.

Data is not cheap here in Africa. There is no “free” WiFi everywhere and anywhere, with the result that our data hungry apps are frowned upon by users who hate apps that will hog their hard earned data. I do too, when I’m the user.

To keep the users happy and smiling, and ensure my app isn’t getting uninstalled every so often here’s what I do:

1. Use Libraries

Libraries such as OkHttp, Retrofit, Picasso and others not only help in ensuring I don’t reinvent the wheel, but also that I don’t spend valuable time resolving a problem someone has already solved (and frustrations someone has already had.

These libraries are tried and tested, have community support and fewer bugs. I know of developers who have been at it for years, and would rather write their own code than use someone else’s because they’re not “lazy”. But then again, that’s personal preference.

2. Use Compression

Most servers have compression enabled or one can configure it themselves, provided you have access to the server. Here are great Google Developer videos on Compressor tricks.

Gzip compression, which I have found is most common, can reduce the size of uploaded or downloaded files by up to 80% or more. Gzip is supported by Android so compressing and decompressing isn’t much of a pain.

3. Judiciously Download Data

Caching reduces access time and ensures I don’t need to download files I’ve already downloaded. If the user is offline, caching means they can still use the app. Cache control from server will make sure I don’t serve user expired data.

What if the server never sends any cache-control headers at all? Well, there’s interceptors for that. OkHttp and Retrofit have interceptors (dangerous interceptors) that will rewrite the server response and ensure caching.

4. Learn Connectivity and User Preferences

Connectivity type coupled with a Preferences page is a useful way to work well with a user’s preferences. If the user prefers to only download or sync data when on WiFi or when on 3G, only then the app will provide flexibility. Add prefetching into the mix and you have a winning recipe. You can prefetch data while on WiFi for later use.

Prefetching is additionally powerful when on a slow network by ensuring that my app is not sluggish or unresponsive when the user opens it because I have already downloaded the data needed by the app. With prefetching you may end up downloading data that is never used. However, given the fact the user is happy, I for one certainly can live with that.

5. Batch Connections

This makes sure my app plays well with the battery through using a single burst to load a number of requests as opposed to loading them individually. GcmNetworkManager can do all this for me.

The back-off pattern is another useful practice that I am yet to use. The idea is to increment exponentially the amount of time between pinging the server asking for new data. We get the same results as pinging at fixed intervals except we reduce radio chip wake time, straining the battery less and making the user happy.

6. Next Up: Server Signals

I haven’t tried the Google Cloud Messaging/Firebase Cloud Messaging approach, which allows us to wait for the server to signal our app when there’s new content. So effectively there’s no need to keep waking the radio chip to ask if there’s new data and consuming battery as well as data. We save on data by not connecting to the server unnecessarily. Plus it could be the fastest way to get through all of the ideas listed above.

Talk to me, whether you’re a veteran developer, newbie, just curious or any other. Let’s chat and teach each other a thing or two about how to be data efficient when developing apps for Africa.

By James Chibwana and original published on TechZim as Things I’ve learnt about being data efficient when developing apps for Africa.

Filed Under: Solutions
More About: , , , , ,

Written by
This Guest Post is an ICTworks community knowledge-sharing effort. We actively solicit original content and search for and re-publish quality ICT-related posts we find online. Please suggest a post (even your own) to add to our collective insight.
Stay Current with ICTworksGet Regular Updates via Email

Sorry, the comment form is closed at this time.