Search Unity

Question Repacked Huawei App Not Calling IInitListener Callbacks

Discussion in 'Unity Distribution Portal (UDP)' started by kromenak, Mar 29, 2022.

  1. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    270
    We are having an issue where our game works fine in the UDP sandbox, but fails to return any IAP items after the game is repacked for Huawei.

    Upon inspecting the log output, we found that the repacked app does not call OnInitialized or OnInitializedFailed from the IInitListener interface after attempting to Initialize.

    Before repacking, calling StoreService.Initialize results in OnInitialized being called shortly after. After repacking, neither OnInitialized nor OnInitializedFailed are called - there's just no result returned from attempting to initialize.

    There isn't too much log output to provide, but here's what we see:
    Our IInitListener callbacks each do a Debug.Log, and in Sandbox, we get the success Debug.Log at this point. However, in the repacked build, we get neither the success or failure Debug.Log triggered.

    I thought this might be a minify/proguard, so I turned off minify entirely, but still got the same problem. I also updated UDP to the latest available version, but still got the same problem.

    What's perplexing is that the store and repack process both worked fine the last time we did this (probably a month or two ago), so it seems as though something has changed recently to result in this problem.
     
  2. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    270
    To provide just a bit more info, I was digging into the UDP Java code, as well as the repacked "smali" code, and this is sort of what I understand is happening:
    1. An instance of com.unity.udp.sdk.provider.huawei.HuaweiProviderService is created.
    2. Based on log output, initialization is at least calling com.unity.udp.sdk.provider.huawei.HuaweiProviderService.init (because the "[DEBUG] provider service init" line is present).
    3. That class saves the init callback into member variable "udpInitCallback".
    From there, it appears udpInitCallback is supposed to be called from "com.unity.udp.sdk.provider.huawei.HuaweiProviderService.onIapSetupFinished", but that is not ever happening. The "Setup finished" log is never output on my end.

    So, I think I have mostly exhausted my debugging ability on this; it appears that onIapSetupFinished should be getting called, but it's not. Even if my device were misconfigured in some way, it should call the initialization failed callback with some sort of error message, I'd argue, if everything was working correctly.
     
  3. kromenak

    kromenak

    Joined:
    Feb 9, 2011
    Posts:
    270
    Ok, eventually figured this out: the UDP repacking system was, at some point, updated to repack with a newer version of the Huawei SDK packages (com.huawei.hms:hwid:6.1.0.303).

    However, for in-game login, my game had a gradle dependency on an older version of this package (com.huawei.hms:hwid:5.1.0.301).

    So, updating my game's login dependency to the later version of com.huawei.hms.hwid seems to have resolved the issue.
     
  4. damelin

    damelin

    Joined:
    Jul 3, 2012
    Posts:
    65
    I am having a similar issue. My sandbox and repacked version (downloaded from Unity's Distribution portal) works fine, but I'm not receiving callback from the repacked version hosted on the Huawei dashboard. Are Huawei repacking the repacked build?

    @kromenak is referring to a com.huawei.hms package, but I can't find any trace of it in my project, even after a Force Resolve.

    Worth noting that I can see the logs for in-app items (auto) querying: onQueryInventory

    My app submission failed because of : Reason for rejection: During the process of In-App purchase, your game did not call Huawei Pay (which make sense if the init callback isn't received)
     
  5. damelin

    damelin

    Joined:
    Jul 3, 2012
    Posts:
    65
    Hi @Unity-Boon , would you have an idea why it's happening for me? Everything seems fine in sandbox, but not with the repacked version
     
  6. Unity-Boon

    Unity-Boon

    Unity Technologies

    Joined:
    Jan 18, 2017
    Posts:
    135
    The Huawei repacking only happened after you select the "Repack game", and publish. It will replace the Sandbox with Huawei login and IAP.

    You may want to click on the Advanced button, and Renew Authentication your Huawei account.

    Screenshot 2023-03-14 at 5.07.01 PM.png