I am confused regarding the (automatic) restore purchases for Android.
We are on Unity2021.3.10 and IAP 4.4.1 and we’re NOT using the Codeless IAP stuff.
I have succesfully bought a non-comsumable. I can see this non-consumable being automatically restored after a new/fresh install of the App.
I also have a Restore Purchase button available (mainly for iOS devices). However I want this to work for Android as well. When pressing the button on Android ‘nothing’ happens. The restore callback is made but the actual ‘ProcesPurchase’ method is never called. On iOS everything is working as expected.
So is this correct behaviour on Android? Will the manual restore always ‘fail’ if the automatic restore has taken place? If yes - how can I disable this as I rather have this linked to an user interaction. Especially since savefiles and userdata is stored online and I want to have (more) control on where the restore process takes place.
I have tried adding allowBackup=“false” to the manifest but this isnt working for me.
If it is not correct behaviour I dont know what is going on…
@PieterAlbers Yes, this is expected on Android. Restore only happens during a reinstall or a new install. This will always happen during IAP initialization. If you are concerned about the timing, just set a boolean flag or similar that you can refer to later, restore would occur in the background. Unfortunately it’s not possible to tell if ProcessPurchase came from a new purchase or a restore. One simple work around, not entirely elegant, would be to just check if no purchase buttons were clicked yet. If not, then it’s a restore. You can also look in the IAP Samples installed in Package Manager and look for the example Google Play Store - 02 Restoring Transactions which demonstrates the following call but I don’t believe it will suppress the auto-restore behavior.
@JeffDUnity3D Thanks for the reply - much appreciated. I have been out of the IAP stuff for a long time.
There are some changes and luckily for the better
I have the m_GooglePlayStoreExtensions.RestoreTransactions(OnRestore) in place in my code.
It is called when clicking a button - the OnRestore callback is made properly but the ProcesPurchase call(s) are never made again for the bought non-consumables - only on reinstall. Should they be called again when the RestoreTransactions method is called?
Just to be complete on my end - I also build and tested the Google Play Store - 02 Restoring Transaction sample from the IAP 4.4.1 package, but the results were the same.
@JeffDUnity3D Sorry for the bump - but did you run that test?
We have a workaround in place atm - but it would be great (better) if the RestoreTransactions() would work as well