So, how would I go about to check that It has been purchased and then remove the ads? Do I stamp the app with a value the moment the purchase is done successfully, or should I check app store every time the app starts or … ? Previously on another app, but using native android, there was an api call I made on start of the app to check what purchases was done. Is there something similar here?
Why would I validate the purchase on my server, as suggested in the same blog ?
On the success callback of a purchase just add some kind of flag and store it using SQLite - don’t use local storage because it can be wiped. Also make sure that you have a way for users to restore purchases (basically just trigger that same process, you’ll get a callback and then store the flag in storage), otherwise your app will be rejected. If a user removes ads from your app on one device, that purchase needs to be able to be applied to any device they use (the restore purchases option solves this).
@joshmorony localStorage never expire! Both localStorage and SQLite will be removed after app unistalling. So there is no different in this point. For this case it’s better to use localStorage to store only a flag. No need to implement local database.
@Lona I didn’t mean using both inAppBrowser and inAppPurchase.
Unless something has changed recently, localStorage isn’t permanent. Anything you store in local storage will likely stick around, but it can be cleared by the OS at any point. So you could store a value and it works fine for 2 months (or forever), but it could disappear at any time.
@joshmorony is correct. Local storage is NOT permanent. Especially true for iOS that is quite aggressive in clearing it (unlike Android). I have a user base with several thousand android devices and iOS devices using my app and I’ve learned the hard way that local storage + iOS == recipe for disaster somewhere down the line when it comes to data persistence.
My app data kept getting deleted for some users. I switched to localforage - SQLite for iOS. For android on only on some phones SQLite seems to randomly hang depending on length of data being stored. So I am using indexDB for android.
And one more issue. As you know SQlite is an async request unlike local storage, so in each part of an authentication system, user will be able to see the view if it’s not authenticated. event.preventDefault() will work after rendered view.