【问题标题】:Using InApp Update API mode Flexible使用 InApp 更新 API 模式 灵活
【发布时间】:2020-09-27 19:23:39
【问题描述】:

我正在使用 In App Update API,更新类型为灵活,使用以下代码

                    appUpdateManager.startUpdateFlowForResult(
                            appUpdateInfo,
                            AppUpdateType.FLEXIBLE,
                            this,
                            APP_UPDATE_REQUEST_CODE)

更新类型以 AppUpdateType.FLEXIBLE 的形式提供。 它展示了正确的 UI,它为用户提供了选择更新或不感谢的选项。 如下图所示。

然而,点击更新实际上展示了一个带有进度条的全屏 UI,通常与立即更新相关联,而不是在后台执行更新。

使用播放代码 SDK 版本 1.8.X

// Rate this app
// So, make sure you also include that repository in your project's build.gradle file.
implementation 'com.google.android.play:core:1.8.0'
// For Kotlin users also import the Kotlin extensions library for Play Core:
implementation 'com.google.android.play:core-ktx:1.8.1'

有人知道为什么会这样吗?

提前致谢。

【问题讨论】:

    标签: android in-app-update


    【解决方案1】:

    也许你的问题是

    override fun onResume() {
        super.onResume()
        appUpdateManager
            .appUpdateInfo
            .addOnSuccessListener {
                // If an in-app update is already running, resume the update.
                if (it.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS)
                    startUpdate(it, AppUpdateType.IMMEDIATE) // <<-- !!HERE!!
                // If the update is downloaded but not installed, notify the user to complete the update.
                if (it.installStatus == InstallStatus.DOWNLOADED) {
                    nav_progress_download.hide()
                    popupSnackbarForCompleteUpdate()
                }
            }
    }
    

    当您单击更新按钮时,会调用 onResume。 AppUpdateType.FLEXIBLE 的 updateAvailability() 与 UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS 相同

    检查一下...

    How to know the AppUpdateType at the origin of the DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS update availability?

    https://issuetracker.google.com/issues/153785560

    【讨论】:

      猜你喜欢
      • 2014-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-16
      • 2022-01-23
      • 1970-01-01
      • 2015-03-25
      • 1970-01-01
      相关资源
      最近更新 更多