Java 限制免费版本的数据库条目
我想提供我的应用程序的免费版本。限制是,一旦您将15条注释保存到数据库中,您将被限制为每月添加5条注释。每次您达到限制,每次您尝试在达到限制后制作新便笺时,我都会提示用户通过应用内购买解锁应用。在初始限制达到30天后,或者如果更容易的话,在月初,他们可以添加5个注释,在他们全部使用之前,我不会打扰他们。限制不会改变Java 限制免费版本的数据库条目,java,android,Java,Android,我想提供我的应用程序的免费版本。限制是,一旦您将15条注释保存到数据库中,您将被限制为每月添加5条注释。每次您达到限制,每次您尝试在达到限制后制作新便笺时,我都会提示用户通过应用内购买解锁应用。在初始限制达到30天后,或者如果更容易的话,在月初,他们可以添加5个注释,在他们全部使用之前,我不会打扰他们。限制不会改变 有人对解决这个问题的最佳方法有什么想法吗?我强烈建议您使用web通信来实现这一点,即使您的应用程序不使用internet。如果您真的希望能够相信用户不会篡改参数来弥补额外的免费使用,
有人对解决这个问题的最佳方法有什么想法吗?我强烈建议您使用web通信来实现这一点,即使您的应用程序不使用internet。如果您真的希望能够相信用户不会篡改参数来弥补额外的免费使用,那么您应该在自己的服务器上进行验证,而不是在他们的设备上 无论何时创建便笺,都应向服务器发送一条带有用户标识符的消息。然后,您可以跟踪注释(即使您没有存储注释的内容),并在需要阻止创建注释时发送消息
通过这种方式,如果必须,您也可以在不更改应用程序的情况下更改阈值。我建议您查看一下。 实现该模式的解决方案包括:
- 用于向数据库添加注释的类。让我们调用方法addNote(Note newNote)
- 包装上一个类并重写该方法的类:
- 处理请求的类应如下所示:
不幸的是,我不能走这条路。我不能要求上网,而且我没有服务器。另一个应用程序的好主意。 class NotesManagement { public boolean addNote(Note newNote) { //Add Note to database and return whether it was successfull or not } } class TrialNotesManagement extends NotesManagement { private NotesManagement notesManagement; public TrialNotesManagement() { notesManagement = new NotesManagement(); } @Override public boolean addNote(Note newNote) { if (isAllowedToAdd()) { return notesManagement.add(newNote); } else { return false; } } private boolean isAllowedToAdd() { //Do the check--Suggestion: in the "database" have a counter that it's reseted each 1st daty of the month } } class AppController { NotesManagement notesManagement; public AppController() { if (isTrial()) { notesManagement = new TrialNotesManagement(); } else { notesManagement = new NotesManagement(); } } public boolean addNote(Note newNote) { notesManagement.addNote(newNote); } }