I created an application for pharma.
Now I want to stop that application after launching 10 times, and also even user can not launch an app after uninstall and reinstall the app.
How could I do that?
Does anyone have an idea?
I created an application for pharma.
Now I want to stop that application after launching 10 times, and also even user can not launch an app after uninstall and reinstall the app.
How could I do that?
Does anyone have an idea?
Now i want to stop that application after launching 10 times
You are welcome to maintain some sort of counter and disable your launch activity when it should no longer be used, via PackageManager
and setComponentEnabledSetting()
.
and also even user can not launch an app after uninstall and reinstall the app
This is not possible. You can store your counter on external storage, some place that will be retained even after an uninstall. However, the user can get rid of your counter file whenever the user wants.
If your application uses net connection you can send a parameter to your service with unique device id. In your service you get the device id and compare with your database. If device id is not in the database (first open of app) create a row with device id and the time stamp. Everytime the user opens the app control the timestamp with today. If it is more than 10 days you can lock the app.
You can use SharedPreferences.
Thats all. Hope this help.