Reputation: 1326
I want to get an idea of what can be done with android in app purchase.
My app gives user some images. Free version has say 10 images, In App purchase can add 10 more & stop all ads.
Now how can i do this?
Do i have to put all 20 images in the app and then just keep a flag somewhere checking if its a free version or paid version? (If yes then where should i keep this flag, in shared Preferences? is there a secure place to store this, some place that doesn't get overwritten with app updates)
Can I update an app after an in app purchase ? Like modify couple of files unser res/raw & res/<> folders ? If yes whats the way to do it ?
Thanks
Upvotes: 0
Views: 91
Reputation: 10242
First of all, you should read the official documentation of In-app billing on Android. What you're asking is doable, but not exactly like you want (you can't update an app in the way you're asking). If you create a managed product the record of it's purchase is kept by Google. You can at any time query Google to verify if the product has been purchased or not. If it has, you can give access to more content and disable ads.
You could keep all the images in your app, but if you want to add an extra layer of security (and the complexity of your own server) you could let your server verify each purchase before making the images available for download. The basic principle of server-side verification is that you take the purchase receipt (purchaseToken) and send it to your server. Your server verifies the purchase using the receipt, a signature and a public key provided by Google. Once the purchase is verified it can be made available for download.
Upvotes: 1