Something like that:)
It mainly depends on the type of purchase in the application: if the content (images, videos, etc.) is downloaded from your servers, you can do checks on the server, and if someone does not hack your server, it will be almost impossible to deceive.
To add / enable functions that are already in the application, you need to save somewhere the list of items that they bought, so the application knows which functions to enable. If you just save it in the file / shared / preferences / DB, someone can just edit them (on the root device, of course) and add whatever they want. Therefore, you need to obfuscate the element’s cache to make it harder to change. One way to do this is to encrypt it on disk and decrypt it in the application. If you use the same key for all devices, it would be trivial to simply copy the file / database to another device to enable functions without payment. This is why you need to extract the key from something specific for a particular device (MAC address, ANDROID_ID, etc.). If you can use your Google account to get the key, but you need to check with the AccountManager that the user really has an account registered on their device (this requires additional permission).
Regarding the use of the equipment identifier, the items / subscriptions are tied to the Google user account, so you can use RESTORE_TRANSACTIONS on any device to receive purchased items. Using a hardware identifier to obfuscate an element cache is not a problem, since it is used only to store things on disk, and not to obtain the purchase status and, thus, does not prevent the user from using the application on multiple devices.
source share