I am writing an application for android and in the app i use some HttpPost
requests.
i have a service in which i schedule 3 request at constant times.
one every 1.5 seconds, one every 7 seconds and one every 20 seconds.
most of times web service don't return any thing.
i install my app on a device and check it for 2 days. this app use 40M data although viber
use only 4M . (i found it by check data usage part at device settings.)
how much data use by a simple HttpPost
request?
how i can reduce data usage in my app ?
Well, the only person able to find out how much any POST request costs is you. It depends a lot on the headers/data you send.
HTTP introduces some overhead in the data sent. For example, using cURL to post just a pair of values p1=v1 and p2=v2, those are the headers sent:
POST / HTTP/1.1
User-Agent: curl/7.35.0
Host: localhost
Accept: */*
Content-Length: 11
Content-Type: application/x-www-form-urlencoded
Those are just the headers (the body adds 11 bytes to this). As you can guess, doing this every 1.5 seconds creates a lot of traffic.
To reduce this, you can do some things:
EDIT: I am assuming you are using POST requests to really post data to the server. If you are using it to get some kind of state from the server, something like (Web)sockets or using push notifications can reduce a lot the requests required.