【发布时间】:2019-09-27 01:01:21
【问题描述】:
在 Google I/O 2019 中,新增了应用内更新。
所以我尝试按照文档使用它:https://developer.android.com/guide/app-bundle/in-app-updates
但它发送了一个类似的 InstallException:
com.google.android.play.core.tasks.RuntimeExecutionException: com.google.android.play.core.install.InstallException: Install Error: -6
at com.google.android.play.core.tasks.k.getResult(Unknown Source:18)
at com.eastriver.workingtimer.ui.MainActivity$onCreate$1.onComplete(MainActivity.kt:35)
我的代码在这里:
val appUpdateManager = AppUpdateManagerFactory.create(this)
val appUpdateInfo = appUpdateManager.appUpdateInfo
appUpdateInfo.addOnCompleteListener {
val result = it.result
if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
&& result.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
info("should show update")
appUpdateManager.startUpdateFlowForResult(
result,
AppUpdateType.FLEXIBLE,
this,
1)
} else {
info("This is already latest version!")
}
}
我知道,它就在今天发布。 但是有人知道吗?
【问题讨论】:
-
有趣。我收到了这个错误:
ERROR_API_NOT_AVAILABLE int ERROR_API_NOT_AVAILABLE The API is not available on this device. Constant Value: -3 (0xfffffffd)
标签: android google-play in-app-update google-play-core