Search code examples
androidandroid-lvlandroid-billing

How to store in app billing activation to make tampering more difficult


I'm trying to use the in app billing v3 and I have seen in the sample before the save() nethod this warning

/*
 * WARNING: on a real application, we recommend you save data in a secure way to
 * prevent tampering. For simplicity in this sample, we simply store the data using a
 * SharedPreferences.
 */

Using the preference normally seems a more simply way to mantain the license status, but according yhis message make easy the tampering.

How should I store the license status? There is some way to use the Preference in some more secure way?

Note that I know that there is always a way to break any protection, but make it more difficult is better.


Solution

  • It's recommended to maintain your own server. Store and use sensitive data from there.

    A way around would be to use SharedPreference. Encrypt data before storing it and Decrypt it when you use it. You need to use javax.crypto.* package to achieve this. Here is an example.