Huawei Android AppUpdateClient - How to test it

1k views Asked by At

I'm integrating in my app the Huawei services for publish in AppGallery. I have integrated the AppUpdateClient https://developer.huawei.com/consumer/en/doc/development/HMS-References/appupdateclient

I have published my app in AppGallery in "Open testing". I build the apk in release mode with a lower version code and I install it on my smartphone.

val client: AppUpdateClient = JosApps.getAppUpdateClient(activity)
client.checkAppUpdate(activity, object : CheckUpdateCallBack {
    override fun onUpdateInfo(intent: Intent?) {
        val status = intent?.getIntExtra(UpdateKey.STATUS, -1)
        ...

The status returned is always 3. Huawei documentation: 3: constant value NO_UPGRADE_INFO, indicating that no update information is available.

If I open the AppGallery it notify me that there is an update for the app and if I click on "Update" it update successfully the app.

How can I test the procedure from my app?

1

There are 1 answers

12
zhangxaochen On BEST ANSWER

Open Testing does not support Update Interfaces. If you publish the “opentest version” of the app on AppGallery, you can update it there. But if you open your lower version of the app on your phone, the Update Interface cannot detect the “opentest version”of the app on AppGallery.

Solution:

  1. If the global version of your app is released on AppGallery, please install a test version on your phone which has integrated the update interface. The version number is earlier than that on AppGallery. Then check whether an update message is displayed when you open the AppGallery.
  2. If the global version of your app has not been released, please install a test version on your phone which has integrated the update interface. Then check whether the interface is invoked in logs, and print related information. That's the method you are using right now.

Open Testing Service documentation