3

我已经在我的应用程序中实现了以下代码,但是在调用 InAppUpdate 代码时出现错误。

fun checkforUpdate() {
  appUpdateManager = AppUpdateManagerFactory.create(this)
    appUpdateInfoTask = appUpdateManager?.getAppUpdateInfo()

            appUpdateInfoTask?.addOnSuccessListener { appUpdateInfo: AppUpdateInfo ->
                if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE // For a flexible update, use AppUpdateType.FLEXIBLE
                        && appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)) { // Request the update.
                    try {
                        appUpdateManager?.startUpdateFlowForResult( // Pass the intent that is returned by 'getAppUpdateInfo()'.
                                appUpdateInfo,  // Or 'AppUpdateType.FLEXIBLE' for flexible updates.
                                AppUpdateType.IMMEDIATE,  // The current activity making the update request.
                                this,  // Include a request code to later monitor this update request.
                                REQUEST_UPDATE_CODE)
                    } catch (e: SendIntentException) {
                        e.printStackTrace()
                    }
                }
            }
        }

调用 InAppUpdate 模块时出现错误:

W/Finsky: [45065] ojr.a(2): No cached information about app applicationame, while trying to retrieve app details.
E/Finsky: [45065] oic.run(7): In-app-update: Missing AppDetails!
4

0 回答 0