Search Unity

How to transfer non-consumable on a different device?

Discussion in 'Unity IAP' started by IvanTesseract, Aug 27, 2020.

  1. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Hi,

    I am facing an issue where non-consumable products are not transferred if I install my app on multiple Android devices. This does not happen with subscriptions.

    The only way that it work was to stop and clear the cache of Google Play Store, but we have complaints from customers that this does not help too.

    Thank you in advance.

    Ivan
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Ensure to use IAP 1.23.5, it should be fixed in that version.
     
  3. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Thank you for the quick reply. I will check that and get back to you.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you continue to have issues, ensure to capture the logcat logs.
     
  5. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Hi again, :)

    So I'm still having issues. It is weird that I need to clear the data of Google Play Store app to get the non-consumable on a different device.
    In logcat_before_clear.txt I don't get the non-consumable even though I own it.
    In logcat.txt at the end you can see the transaction finishing after I clear Google Play Store data.

    Does this make any sense?
     

    Attached Files:

  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What did you find in the logs? Sorry I would not be able to search a large log file, only provide the relevant IAP-related log entries. I typically run "adb logcat | findstr - i unity" (grep on Mac)
     
  7. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    What I found is that I have to clear the storage data of Google Play Store and then IAP is detected.
    Seems like a bug in the plugin, since subscriptions work fine.
     
    IztokMan likes this.
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide the log portions that I may present to engineering.
     
  9. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Which part of the log? Only UnityIAP entries?

    The logs I sent you are only Unity and UnityIAP entries.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes and any other relevant errors or exceptions that appear around those log entries. You'll want to add many Debug.Log statements in your code with the runtime values of your objects and variables which will appear in the logs too on Android, they are invaluable for debugging. As is break point debugging the app running on the device using Visual Studio https://forum.unity.com/threads/tips-for-new-unity-users.701864/#post-5057741
     
  11. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Ok, the files I sent you have the relevant logging.
    Not sure what good would be for you you to use my breakpoints though.
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry I did not receive them. Debugging is for you to debug your app. You could provide screenshots to share the information. Show your code, the Debug.Log statements in all your IAP callbacks, then the relevant log entries as requested. Your one log file is over 2MB, I would expect perhaps 30 lines of relevant log information instead. Please review them, they are text readable files, and include only the relevant portions.
     
  13. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    All right, I will try to extract relevant lines. Is there a method in the IAP where I can force restore purchases on Google Play Store? I couldn't find anything like that.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Restore happens automatically on Google when you uninstall and reinstall the app, or first install on a device. You'll see ProcessPurchase triggered at IAP initialization. Also keep in mind that there are known issues with Restore across devices that is being discussed on the IAP forum here https://forum.unity.com/threads/iap-restore-issues-android.653608
     
  15. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Ok, yes, I am aware of that. For some reason this doesn't happen for non-consumables. I have to remove the storage data of Google Play Store. Even more curious is that I have to do the same if I refund a non-consumable, but for subscriptions it works ok.
     
    FADEFALCON likes this.
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    "For some reason" is a known reason that is described in the link I shared. Restore across devices has issues. Simply test Restore on the same device. To be clear, this isn't a solution, it's a troubleshooting/fact finding suggestion. The logs will be valuable to share with engineering, but I can't hand over a 2MB unreviewed log file.
     
  17. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    All right, thanks for that, I will do my best to give you meaningful logs. We have more than a few users that want to use the app on a phone and on a tablet at the same time.
     
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Use grep on Mac, findstr on Windows to filter the logs. Or just copy-paste using manual inspection. Be sure to add the Debug.Log statements in your code. Then show the corresponding log entries and your code.
     
    IvanTesseract likes this.
  19. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Hi,

    Is there any update on this bug.
    In my testing I can make a workaround by pressing on the IAP purchase again and then it is recognized as bought, but for production users this doesn't work.

    Subscriptions work fine, only non-consumable products are bugged.
    This bug was not present in previous versions of the IAP api.

    To easily recreate this issue use 2 Android phones with the same account.
    Buy a non-consumable product on one phone. When you open the app on the other one the non-consumable is not registered.

    Please look into this issue, as it makes problems for paying customers.

    Thank you in advance.

    Best,
    Ivan
     
  20. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What version of IAP are you using? As mentioned, we are aware of the restore issue across 2 devices. I had asked to test only on one device for now, sorry for the confusion. Also, did you place the Debug.Log statements in your IAP callbacks (like in the Sample IAP Project) and review the logs? Filter for only your log entries.
     
    Last edited: Sep 25, 2020
  21. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Hi,

    I am using the latest version. You can also re-create this issue by canceling the purchase, and the purchase doesn't gp away.
    Since you are aware of the issue when can we expect a fix. This affects our paying customers on Android and ratings of the app
     
  22. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please confirm the version that you are using.
     
  23. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    At the moment in the package manager I can see 2.1.0. Is this the version what you are referring to?
     
  24. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    The version of the imported iap in the project is 1.23.5.
     
  25. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you please try with the latest version, 2.0? Make sure to read the release notes.
     
  26. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Do you mean 2.0.6 verified version? It was the same with that, that's why I updated to 2.1.0, most likely this bug is in multiple previous versions.
     
  27. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, I mean the latest version of IAP. You mentioned 1.23.5, but the latest is 2.0. In the Unity Editor, go to menu Window/Unity IAP/IAP Updates. Or you can update in the Services window. So you manually updated Package Manager? So you know, Unity IAP currently requires both an Asset package and an Package Manager package, best to allow the installation to make the updates.
     
    Last edited: Sep 25, 2020
  28. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Uh, does this require updating to Unity 2020?
     
  29. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No it does not require Unity 2020
     
  30. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Oh sorry, I have 2.0.0 installed.

    Screen Shot 2020-09-25 at 19.10.54.png
     
  31. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it. Yes restore across devices is something we are working on, we need to coordinate with the newer Google billing library API.
     
  32. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    All right, since this issue affects income and ratings on Android, do you have some target date when this will be released?
    Is there a workaround that I can use to fix this? Maybe you can recommend a different plugin/asset for Unity that you can recommend for the mean time?
     
  33. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Also some users have experienced that non-consumables disappear, if they for example remove or add an account. I am assuming this is the same issue.
     
  34. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Hopefully within a month or two, we are bit resourced constrained currently. You might want to look here, probably test in a separate project first https://developer.android.com/google/play/billing/unity
     
  35. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We would need steps to reproduce. We heard of that behavior on previous releases, but has been addressed.
     
  36. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Yes, the problem is that it hasn't happened in my own tests, therefore I will let you know how to reproduce it.

    Thanks for the link, I will look into using that in the mean time.
     
  37. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    I don't think I will be able to use this plugin from Google, as it looks like it uses older version of the Unity's IAP layer and the classes that it uses are not public most likely. Is there some plugin for Google Play that doesn't use UnityEngine.Purchasing?

    So at least we can use it until this issue is fixed?
     
  38. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    That is up to you, we would not be able to support it however. I'm not familiar with other options.