Unable to submit build to Xiaomi?

Greetings,

we’re trying to upload our build to Xiaomi through Unity’s Cloud Build but we are unable to do so. We tried both uploading from the editor and the dashboard, in both cases there was no “Push To Xiaomi” option available in the arrow/drop down menu besides the build/apk, only “Download Apk”. (View attached screenshots)

  • We’re on Unity 2017 1.1p2.
  • We have IAP, Cloud and Collaborate services enabled.
  • Ads services is disabled, we use the dedicated Unity Ads plugin instead as we’ve had problems with the built-in Ads.
  • We use the latest Unity IAP that has the Xiaomi support in it (Unity Channel plugin etc)
  • We have targeted Xiaomi store in the editor via “Window | Unity IAP | Android | Target Xiaomi Mi Game Play”
  • We have generated the required product file “MiProductCatalog.prop” which contains our in-game products. (File is under Plugins/Android/assets/MiProductCatalog.prop)
  • We have set the package name/bundle identifier to end with “.mi”
  • No Chartboost, Google Play Games, Facebook or any other plugin
  • Implemented the necessary codes for IAP/Unity Channel to work
  • Tried both specifying the AppInfo class in code and via the AppStoreSettings.asset file, didn’t make a difference.

This screenshot shows the menu where the “Push to Xiaomi” option should show but it’s not, only “Download APK file”

This just shows that we have Cloud enabled

This is the IAP related peice of code:

public class XLoginListener : ILoginListener
{
    public Action OnInitSuccess;
    public Action<string> OnInitFailure;
    public Action<UserInfo> OnLoginSuccess;
    public Action<string> OnLoginFailure;

    public void OnLogin(UserInfo User)
    {
        Debug.LogErrorFormat("[Xiaomi] Login Succeed: userId {0}, userLoginToken {1}, channel {2}",
            User.userId, User.userLoginToken, User.channel);
        OnLoginSuccess.SafeInvoke(User);
    }

    public void OnInitialized()
    {
        Debug.LogError("[Xiaomi] Initialization Succeed");
        OnInitSuccess.SafeInvoke();
    }

    public void OnInitializeFailed(string Message)
    {
        Debug.LogError("[Xiaomi] Initialization Failed: " + Message);
        OnInitFailure.SafeInvoke(Message);
    }

    public void OnLoginFailed(string Message)
    {
        Debug.LogError("[Xiaomi] Login Failed: " + Message);
        OnLoginFailure.SafeInvoke(Message);
    }
}

public class XPlatformDef
{
    public XLoginListener LoginListener;
}

XPlatformDef XPlatform;

void Xiaomi_Init()
{
    StandardPurchasingModule Module = StandardPurchasingModule.Instance();
    ConfigurationBuilder Builder = ConfigurationBuilder.Instance(Module);

    ProductCatalog Catalog = ProductCatalog.LoadDefaultCatalog();
    foreach (ProductCatalogItem Product in Catalog.allProducts)
    {
        if (Product.allStoreIDs.Count > 0)
        {
            IDs IdList = new IDs();
            foreach (StoreID ID in Product.allStoreIDs)
            {
                IdList.Add(ID.id, ID.store);
            }
            Builder.AddProduct(Product.id, Product.type, IdList);
        }
        else
        {
            Builder.AddProduct(Product.id, Product.type);
        }
    }

    //NOTE(Ali): the process is as follows:
    // - initialize Xiaomi store via StoreService.Initialize
    // - on success, initialize Xiaomi login
    // - on success, initialize Unity IAP
    XPlatform = new XPlatformDef();
    XPlatform.LoginListener = new XLoginListener();
    XPlatform.LoginListener.OnInitSuccess = () =>
    {
        StoreService.Login(XPlatform.LoginListener);
    };
    XPlatform.LoginListener.OnLoginSuccess = (UserInfo User) =>
    {
        UnityPurchasing.Initialize(MobilePlatform.Purchasing, Builder);
    };

    #if (!UNITY_EDITOR)
    {
        AppInfo App = Xiaomi_GetAppInfo();
        StoreService.Initialize(App, XPlatform.LoginListener);
    }
    #endif
}

AppInfo Xiaomi_GetAppInfo()
{
    AppInfo Result;
       
    Result = new AppInfo();
    Result.appId = "<actual app id>";
    Result.appKey = "<actual app key>";
    Result.clientId = "<actual client id>";
    Result.clientKey = "<actual client key>";
    Result.debug = true;

    //Tried this, thought it would make a difference in detecting the build and be able to push, didn't matter much.
    //AppStoreSettings Settings = Resources.Load<AppStoreSettings>("AppStoreSettings");
    //Result = Settings.getAppInfo();

    return(Result);
}

I’m not sure what we’re missing or doing wrong here. If anyone has any idea/hints/tips/pointers it would be much appreciated.

Thanks.

Hi,
Sorry you’re having a rough time with this! Just to help troubleshoot; is the user who is attempting to submit to Xiaomi the owner of the organization that project is under?

@rachelgarza Thank you very much! That was it.

We spend approximately 6 hours yesterday messing around with this, reading documentation and getting frustrated with the support staff, and nowhere was this crucial point happened to be mentioned…

Great! Glad that solved it for you. You’re right, the documentation could definitely use some clarification on that… Will work on getting it updated ASAP.

Thanks!