Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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:
    266
    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:
    266
    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:
    266
    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.