There are applications in which people post publications once a day.

It is necessary as in the application to limit them in the publication of publications. I do not even know how to implement it.

I could do it on the site in the database, but my task is to make restrictions in the application.

If you have any textbooks, publications or have come across this, please share.

    1 answer 1

    The right decision is to make a request to the server when the application starts, which will tell you if the post was made today. Or even better, every time you try to upload a post to the server, it will return a "limit reached" error.

    If in the application - at the time of successful post posting to the server, write a flag in SharedPreferences that says that the post was flooded today. But this solution can be hacked by cleaning these applications or through the root to change. The server option is much more reliable.

    And think for yourself, the person has two phones. one post he filled. How does a second phone without a server know that the post has already been flooded? No in the end, how many people have devices, how many posts he has per day, and can he

    UPD: Getting IMEI in the easiest way.

     TelephonyManager telephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); String deviceIMEI = telephonyManager.getDeviceId(); 

    But better read the article on Habré or here in English and the article from Google

    • there is simply no authorization in the application and all that the server knows about the user is the ip which is easy to change using VPN - user8978194
    • Well, the phone has imei, it does not change. but again, the problem with many devices you do not solve. rather, there is no such problem. since you do not have authorization, the client is essentially a telephone, not a person - Sviat Volkov
    • cool idea with it) is something to think about. if you know how to display it correctly, I’ll be blogging) - user8978194
    • one
      IMEI absent in devices without a telephone module. Also for access to it Requires the READ_PHONE_STATE permission. - Eugene Krivenja
    • one
      The best option, in my opinion, is ANDROID_ID , as in the blog for the last link written. - Eugene Krivenja