I could not update the software from Huawei Store app gallery

225 Views Asked by At

how doing force update app from app gallery

Updateinfo is not recommend, reason: Uninstall the old version before installation ,is same signature: 1

this is the function i used :

fun checkAppUpdates() {
    val client = JosApps.getAppUpdateClient(this)
    client.checkAppUpdate(this, object: CheckUpdateCallBack {
        @SuppressLint("SuspiciousIndentation")
        override fun onUpdateInfo(intent: Intent?) {
            intent?.let {
                // get the status of the app update check
                val status = it.getIntExtra(UpdateKey.STATUS, -1)
                // if there is any error, the code and reason will be returned by this extra
                val errCode = it.getIntExtra(UpdateKey.FAIL_CODE, -1)
                val errMessage = it.getStringExtra(UpdateKey.FAIL_REASON)
                // get the result info serializable
                val info = it.getSerializableExtra(UpdateKey.INFO)
                // if info is an instance of ApkUpgradeInfo, there is an update available for the app
                if (info is ApkUpgradeInfo) {
                    showToast("there is update",ToastableType.Info)
                    client.showUpdateDialog( this@MainActivity, info as ApkUpgradeInfo?, false)
                }

            }
        }
        override fun onMarketStoreError(responseCode: Int) {
            // This method is reserved, no implementation needed
            showToast("${responseCode}")

        }
        override fun onUpdateStoreError(responseCode: Int) {
            // This method is reserved, no implementation needed
        }
        override fun onMarketInstallInfo(intent: Intent?) {
            // This method is reserved, no implementation needed
        }

    })
}
0

There are 0 best solutions below