问题
I'm searching for a tutorial or an explanation on how to remove advertisement in my application with in-app purchase?
I will put some ads with ad-mob in my app but I also want, that the user can disable the ads when he pays a little donation. Do you know a site or tutorial where I can find a step-by-step explanation how to do this?
Or do I need to publish 2 versions of my app? One with ads and one without ads for paying?
回答1:
Don't use the SharedPreferences method because if the user flushes the app data or uninstalls/reinstalls your app their ad-free status will be lost.
A couple of ideas:
- If your app has any kind of web based login or authorization, you can flag the user as having bought the ad free version by updating the web database's customer data and then disable ads in code following login and verification. This has the added benefit of following the user to new devices.
- Use one of the several ways to get a unique device id, and store that in a web server database. On startup, query the DB to see if the device is ad-free. See Android Unique Device ID. This will only work for that particular device though.
The two apps approach is simple enough to get the job done too. :)
回答2:
This presentation seems to explain an example and includes a link to source code at github: http://gotocon.com/dl/2011/GeekNights/Tjen_penge_p%C3%A5_Android_ARH.pdf . It stores the purchased upgrade at a sharedpreference.
However, I'm still looking for a more secure and robust solution that works out the use-case explained here: http://vlingo-en.custhelp.com/app/answers/detail/a_id/1785/~/moving-in-app-purchase-(ad-removal)-to-new-android-phone/p/180
来源:https://stackoverflow.com/questions/9325709/removing-ads-with-in-app-purchase