6

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?

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
TizioIncognito
  • 183
  • 1
  • 8

1 Answers1

5

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

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • Hi, do you have any sources for the above solution? – baribar Apr 07 '21 at 08:12
  • 1
    hi@ bari coronel, you can refer this [Docs](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050121216?ha_source=hms1) – zhangxaochen Apr 08 '21 at 01:08
  • Hi @shirley, I already followed the steps but I am getting an error in logs before getting the status: 3. `W/UpdateSDKCheckTask: UpdateSDK get update info is not recommend,reason: Uninstall the old version before installing,is same signature: 1` – baribar Apr 08 '21 at 02:52
  • hi@ baribar,May I ask have you changed your signature? – zhangxaochen Apr 08 '21 at 03:33
  • hi @shirley, may I know which signature is the one? – baribar Apr 08 '21 at 03:51
  • hi@baribar,I'm talking about your app signature – zhangxaochen Apr 08 '21 at 06:16
  • Hi @shirley, thanks for the update. For the solution 1, do I need the same signature from the released app to build my test app? – baribar Apr 20 '21 at 01:54
  • hi @baribar,do I need the same signature from the released app to build my test app? --yes,The signatures of the same application must be the same. – zhangxaochen Apr 20 '21 at 02:07
  • @shirley, can you tell me, is it necessary for user to be logged in in huawei app gallery to update check? and will it work for debug build or I have to create signed build to check this? – Asad May 25 '21 at 10:10
  • @Asad,You are advised to use the signed app for verification. If the signatures are inconsistent, the upgrade cannot be performed. – zhangxaochen May 26 '21 at 01:37
  • @shirley, one more thing.. where we decide the update is forceUpdate or normal update? (to pass in the showUpdateDialog method) and if its force update, will user be able to dismiss update popup dialog or popup dialog will remain sticky until user update the app? – Asad May 26 '21 at 13:49
  • 1
    @Asad,Normal update is fine. Forced update has special switches and configurations and is only available for games.Normal update users can choose not to update apps. Forcible update users can use apps only after they are updated.For detail,you can check [Not Forcibly Updating Your Game](https://i.stack.imgur.com/CiWxu.png),[Forcibly Updating Your Game](https://i.stack.imgur.com/YmP4U.png),And here are [Docs](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/appgallerykit-game-update-0000001055756860#ZH-CN_TOPIC_0000001055756860__section12916191111522). – zhangxaochen May 27 '21 at 01:31