Right now, I have developed an android app that is available free on the market. The app basically uses HTTP GET
to query some data from my personal server. I'm a wee bit worried about bandwidth as my server is hosted and thus has limited monthly transfer.
I was just wondering, is there a robust way to limit the number of requests made by each user per day, say, to 20 requests?
For some background, the app interface is pretty straightforward. Two EditText boxes to capture the HTTP GET parameters and a Button
to submit the request. This eventually returns some values from a cgi script which populates a TextView
on the app.
Solutions can be either on app end or server end. An idea I had was to somehow write the number of requests already made to a file and reading the status from there.
Are there better ways of achieving what I want?
Just a suggestion:
In your APP:
Generate a unique id for each device (see this question.) and send it to the server with the request.
In your server:
store requests count from each device somewhere and apply any limitation you want based on the stored value.
Note that you could limit the requests by IP on server side. The problem with this approach is you're also limiting the users connected to the internet with a shared IP (ex. multiple devices connected to an access point, etc.)