Using IAP to remove adverts

@timespacemagic Another option would be to do the same thing but query an SQL database on the device.

Maybe the pro.txt could contain a random hash generated against something unique to the device (or receipt number)?

Also I have the filename set to something different then pro.txt, I would suggest removing the .txt extension. [import]uid: 62706 topic_id: 30111 reply_id: 120845[/import]

@CraftyDeano I have thought about that too, I previously used and sql database to store game states, and it worked great. It’s a little less straightforward than adding a pro.txt, but I believe it’s still possible to simply open the sql3 database to edit the values. If only Corona had a way to encrypt the sql3 database like SQL Cipher etc.

I also considered your idea of using a unique ID. It would make perfect sense to call system.getInfo(“deviceID”) and hash the UDID, but I briefly read somewhere on the forums that Apple is taking a stance against using UDID, and rejects apps that make the API call.

I feel like I’m being paranoid about all of this, but you never know man :stuck_out_tongue: [import]uid: 108204 topic_id: 30111 reply_id: 120851[/import]

Hmm, could use ( system.getInfo( “name” ) ). It would return ‘Deans iPhone’ and is fairly unique, as UDID is being depreciated but apparently going to be replaced with something else?

Only problem is that users can change the phone name on the fly (although I have always used default and not needed to change it) causing the validation to fail, however restoring the purchase could resolve that.

Edit:

After a bit of research I think this is what ill implement something like the below:

[lua]function checkifPro()
local deviceName = ( system.getInfo( “name” ) )
local cryptoKey = “SuperSecretPassword”
local fileName = crypto.hmac( crypto.md5, deviceName, cryptoKey)
local path = system.pathForFile( “fileName”, system.DocumentsDirectory )
local file = io.open( path, “r” )

if file then
isPro = true
io.close( file )
end[/lua] [import]uid: 62706 topic_id: 30111 reply_id: 120856[/import]

Thanks, I can now see how to signal the app that ad removal and other goodies will be available once they do the in-app purchase.

what I’m still wondering about is how does the app make that check if the app gets removed and then reinstalled? If they remove the app or wipe the phone clean and reinstall a fresh copy, the file or DB entry won’t be there anymore. What if they get a new device and install the same app on 2 devices?

Is there a way to make a double-check to see if their account made the purchase in the past?

EDIT:
ok, I’m answering my own question, but the store.restore() function will generate a callback for every in-app product that was purchased. I can then either do the same file creation or database entry all over again :slight_smile: [import]uid: 146178 topic_id: 30111 reply_id: 133882[/import]

Thanks, I can now see how to signal the app that ad removal and other goodies will be available once they do the in-app purchase.

what I’m still wondering about is how does the app make that check if the app gets removed and then reinstalled? If they remove the app or wipe the phone clean and reinstall a fresh copy, the file or DB entry won’t be there anymore. What if they get a new device and install the same app on 2 devices?

Is there a way to make a double-check to see if their account made the purchase in the past?

EDIT:
ok, I’m answering my own question, but the store.restore() function will generate a callback for every in-app product that was purchased. I can then either do the same file creation or database entry all over again :slight_smile: [import]uid: 146178 topic_id: 30111 reply_id: 133882[/import]