Sorry if this is a dupe, I can’t seem to word it well enough.
I have an IAP called pblockads which as you may guess blocks ads.
Once that’s purchased I save a variable called adsBlocked = true;
I have recently created a backup system for my games save files using FTP and unique codes that all users can use.
At the moment, it’s possible for one person to purchase block ads and share the save file with anyone else.
What I want to do on start for all users is somehow check if they have ever purchased pblockads on their google play account, and if not I can then rectify this by setting adsBlocked = false;
I hope this is understandable, I have looked briefly at the receipt validation but I’m not sure if that’s what I need for this or not.
I would not recommend such a save file system. You should encrypt the file and keep it on the device only if that is the approach you want to take. Storing in PlayerPrefs is one solution, but make sure to test when the user reinstalls the game as PlayerPrefs can be removed on many Android systems during reinstall. Also, I might recommend not spending too much time on this, users are going to get around any system. Those users are typically quite rare. I might instead recommend to focus your efforts on making a great game that is fun and engaging to play!
I am using EasSave 3rd party saving asset which encrypts all save files, I’m not concerned about users editing them, and yes you’re right that people will find a workaround for literally anything anyway, I was just curious if it was possible to make a check to google play if any purchases have been made for this app and if so I can make necessary changes.
Yes, you can iterate through the receipts of the products in your controller. Look for the code in IAPManager.cs in this sample project under the OnInitialized event Sample IAP Project
foreach (Product item in controller.products.all)
{
if (item.receipt != null)
{
if (item.definition.type == ProductType.Subscription)
{
string intro_json = (dict == null || !dict.ContainsKey(item.definition.storeSpecificId)) ? null : dict[item.definition.storeSpecificId];
SubscriptionManager p = new SubscriptionManager(item, intro_json);
SubscriptionInfo info = p.getSubscriptionInfo();
MyDebug("GetSubInfo for : " + info.getProductId().ToString());
}
else
{
Debug.Log("the product is not a subscription product");
}
}
else
{
Debug.Log("the product should have a valid receipt");
}
}
}