首先,自动卸载app并不是一个好方法.尝试禁用所有功能.
Generally, you need the following algorithm:
1) On starting your app (for example in first activity) get SharedPreferences (http://developer.android.com/reference/android/content/SharedPreferences.html) and check key with date of first start (for example "firstStartDate"). Also, reads key "lastStartDate".
2) If key "firstStartDate" doesn't exist - it's first start of your app, get current date and write it as value of both keys, than continue normal work of app.
3)如果存在密钥"firstStartDate" - 获取当前日期并检查您的试用期是否已过期(在第一个开始日期和当前日期之间计算天数).另外,在"lastStartDate"中检查当前日期是否大于或等于日期(保护设备上的日期不变).如果当前日期小于"lastStartDate" - 它是日期黑客和用户移动时间.在这种情况下,您可以完成试用(参见第5点).
4)如果试用期未到期 - 确定,继续正常工作并将当前日期写入"lastStartDate".
5)如果已过期 - 向用户对话框(http://developer.android.com/guide/topics/ui/dialogs.html)显示有关过期试用的参数cancellable = false和单击对话框按钮时关闭活动.
我认为这比仅卸载应用程序要好得多.
| 归档时间: |
|
| 查看次数: |
1300 次 |
| 最近记录: |