0

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?

4

1 回答 1

1

只是一个建议:

在您的应用程序中

为每个设备生成一个唯一的 ID(请参阅问题。)并将其与请求一起发送到服务器。

在您的服务器中

存储来自每个设备的请求计数,并根据存储的值应用您想要的任何限制。


请注意,您可以在服务器端通过 IP 限制请求。这种方法的问题是您还限制了使用共享 IP 连接到 Internet 的用户(例如,连接到接入点的多个设备等)

于 2012-05-12T08:19:35.680 回答