Automate your Unity Project with AppGallery Publishing API

Mustafa CAN
Huawei Developers
Published in
3 min readJan 4, 2022

--

đź“– Introduction đź“–

In this article, I’ll be guiding you on how to implement Publishing API into the Unity game engine with HMS Unity Plugin v2.1.x version.

Note: Publishing API is a content of Publishing API. So you first need to implement Connect API from this link.

🚧 Getting Started 🚧

We are going to use HMS Unity Plugin from Github.

After integrating the plugin into your game, We are ready to start using Publishing API via Connect API.

✨ Setting up Publishing API✨

After integrating Connect API and importing Plugin into our project, go to Huawei > Connect API > Token Obtainer from the topbar of the Unity.

Huawei > Connect API > Token Obtainer

Than enter your Client ID and Client Secret (you can find them in your agconnect-services.json file)

You can see the token in the console. No need to copy it. Just know that your cliend id and secret are correct.

Than go to Huawei > Connect API > Publishing API > Querying App Information. In this window, we can able to see our projects informations but the important part is not infos.

Check App infos and check or uncheck the “Upload After Build” functionality.

If you check the “Upload After Build” checkbox, than Unity will ask you to upload your apps APK or AAB packages to the App Gallery Connect whenever you made a successful build.

After a successful build, Unity will ask you to upload your package to AGC

If you accept to upload (by clicking “OK”), than your newly builted APK or AAB will be sent to your AGC website as a “Draft” new version.

You can check the progress bar or Console logs to see the progress steps.

Now, you can see your uploaded package from going to your project and clicking Draft from the left hand menu.

You can see your apk or aab file in the App version section.

đź’ˇ Conclusion đź’ˇ

We’ve learned how to use Publishing API to upload our game packages to AGC for creating small scale CD pipeline.

Don’t hesitate to ask questions.

--

--