3

There was a similar subject here

Okay. We can find out about user's purchase using RESTORE_TRANSACTIONS request to Google Play. But. It is written in documentation that " You should use the RESTORE_TRANSACTIONS request type only when your application is installed for the first time on a device or when your application has been removed from a device and reinstalled." Why not after every start? It looks comfortable and possible to query Google Play every time when the app starts.

Otherewise

1) I should store information about payment on my WEB server

2) Or I should save this info to sdcard. The record should be secure, including device ID, so that copy on another device will not work

So. Which way is better? Thanks.

Community
  • 1
  • 1
nms
  • 577
  • 1
  • 10
  • 27

1 Answers1

3

I would suggest:

3) Use the in-app Shared-Preferences Class or SQLite Database

(Check this page: http://developer.android.com/guide/topics/data/data-storage.html)

Encryption is always good, but this way the data is so to say attached to your application and can usually not be accessed by other apps.

Nippey
  • 4,708
  • 36
  • 44
  • Why not. However Shared Preferences and DB can be edited on a rooted phone. Hence, you must ensure that the information about payment is signed in a way that cannot be imitated. – rds Aug 31 '12 at 08:35
  • That's why I said 'Encryption is always good' and 'can usually not' ;) But this way the data is bound to your application. – Nippey Aug 31 '12 at 08:44
  • Yes, really. Shared-Preferences looks good, if it is impossible to read it from another app or to hack somehow. Especially if the data will not expire after turning the device off. I think the algorithm is easy. 1) First check data in Shared-Preferences. 2) If not found then check purchase on Google Play. I think that no need of SQLite Database for 2-5 numbers. Thanks. – nms Aug 31 '12 at 09:34
  • Please consider: Everything can be hacked and on rooted devices you won't have the chance to hide anything. So always take care of a "child safety lock". Offtopic: Using SharedPreferences, you can also set default values for initialisation, so you can create a variable "firstRun = true" which will be set to false by your application and then stay false as long as your app keeps installed. – Nippey Aug 31 '12 at 10:39