Google Inapp purchasing and trial period

情到浓时终转凉″ 提交于 2019-12-13 14:16:25

问题


I am building an application which I wish to upload to the app store as a paid app. But i would like to post it as a trial app for a set amount of time. I looked at all the options in the app billing version 3. I have found a few problems.

  1. If I create my app with a non-consumable inapp item then i will not be able to keep it for a set duration as a trial app(Please let me know if my assumption is correct).

  2. I f I create it via a subscription based model then is there a way I can make the subscriptions last forever and not yearly?


回答1:


I think I know what you're asking, but if I'm wrong let me know.

What you want to do is let the user download the app for free, let them use it for say 7 days, then require them to pay for the upgrade IAP (in app purchase) or prevent them using it?

If the above is correct there is one main problem that you're going to encounter. To track the date the user started using the app you will have to use something like a shared preference, an entry in a sql db or some local file etc... The only problem with all of these options is the user can erase the data and install the app again to use it free for another 7 days. The only way around this is to implement your own web registration service which I imagine would be a little too difficult.

The best way, assuming you're not too bothered about the people who will bypass it, is to capture the date/time when the app first starts and save it. Each time the app starts check if they have purchased the upgrade, if not check the current date/time against the stored value and if your trial period has elapsed, prompt them to buy the upgrade or close the app.




回答2:


The main problem here is the user uninstalling / reinstalling the app and losing the shared preferences.

The easy way around this is to use Google's SharedPreferencesBackupHelper

Android SharedPreferences Backup Not Working

You simply save the install date as a preference. Even if the app is un-installed, if they install it again, the orig install date will still be available for you to query.



来源:https://stackoverflow.com/questions/17086041/google-inapp-purchasing-and-trial-period

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!