Search Unity

Android Google Play IAP RestorePurchases - Only does 1 non-consumable restore per app start

Discussion in 'Unity IAP' started by BeeSmart, May 2, 2019.

  1. BeeSmart

    BeeSmart

    Joined:
    Dec 6, 2013
    Posts:
    14
    Android - Google Play
    Windows 10
    Unity 2018.3.3f1
    IAP Version 1.22.0


    non-consumables included in this demo
    1. No-Ads
    2. Full Access + No-Ads (Includes 1, 3, 4, 5)
    3. Test Package1
    4. Test Package2
    5. Test Package3

    I have made test purchases of #1, #5, #3 in that order. When I uninstall the app and re-install, the Codeless IAP automatically calls my BuyComplete method to restore the item but it only fires once per app start. I had to close and re-start the app two more times to restore items #5 and #3.

    Thoughts on what I am missing?

    Thanks

    Chris
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
    Are you using an IAP Listener? What are you passing to your BuyComplete method, please show your code.
     
  3. BeeSmart

    BeeSmart

    Joined:
    Dec 6, 2013
    Posts:
    14
    Hi Jeff - responded to this on another post.
    https://forum.unity.com/threads/iap-restore-issues-android.653608/#post-4510435

    In summary, I was setting the IAPButton.SetActive(false) prior to my BuyComplete method finishing. This works fine when you make the initial purchase of the item but during the restore of multiple non-consumables, this causes the restore to hang on the first item restored. I assume there is a callback after BuyComplete which signals to send the next non-consumable, with the IAPButton now inactive, it cannot/does not send that callback. Just guessing but I assume that is the problem. I changed SetActive(false) to interactable = false and the restore of multiple non-consumables works fine now on the Android.