-1

In my android application everything is based on web services with JSON requests and responses.

The user that is using their mobile data with a poor internet connection needs the application to work fast. So I want to reduce the amount of data sent between the phone and server.

How do I reduce the payload size? Is there any tool or library to improve the effective data transfer rate over a mobile connection?

Raceimaztion
  • 9,494
  • 4
  • 26
  • 41
John
  • 1,407
  • 7
  • 26
  • 51

2 Answers2

1

There is no silver bullet in this situation, it's a pretty complex problem that differs from one app to another. Usually the main problem is the actual amount of data you transfer and there are no magic tools that solve that.

Here are a couple of general methods that help. If you haven't used any of them yet, they could have a great impact:

  • Make sure all of your http requests are gzipped
  • Make sure you don't send or receive any more data than you need at the very moment you need it. This might require splitting some of your requests to ensure you only get the data you need.
  • Always request your data asynchronously
Moti Azu
  • 5,392
  • 1
  • 23
  • 32
  • gzipped i haven't uesd, i will implement in my app, thanks for the useful info, remaining two already there in my app, thanks for the quick response. – John May 28 '15 at 09:10
  • Gzip should be enabled by your server rather than the app. Standard http clients will use http compression when available. – Moti Azu May 28 '15 at 11:17
  • To use the Gzip server support also required? i mean i will compress the request and send to server and from back end decompression is required is that right – John May 29 '15 at 06:30
  • You don't need to do it yourself, any half decent library would do it. But you need to enable http compression on your server for that to work. – Moti Azu May 29 '15 at 18:03
1

Generally, two approaches are used. I think you already know.

  • Cache the data: use internal data storage. For RDB style approach, you can consider OrmLite or SqlLite.

  • Compress http communication in gzip: read this article to apply to the app.

Community
  • 1
  • 1
Youngjae
  • 24,352
  • 18
  • 113
  • 198