我正在尝试集成新的应用内更新 API,但我无法测试它的实现。似乎我的代码很好,因此我阅读了 Troubleshoots并且无法理解本文档中的 2 点
Make sure that the app that you are testing is signed with the same signing key as the one available from Google Play.
If the app you are testing doesn’t appear with an available update, check that you’ve properly set up your testing tracks.
无论如何,我只想在我的设备上进行测试,我从 Play 商店版本中减少了版本代码,但它总是显示
UPDATE_NOT_AVAILABLE
.这是代码: -
val appUpdateInfo: Task<AppUpdateInfo> = appUpdateManager.appUpdateInfo
appUpdateInfo.addOnSuccessListener {
if (it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE && it.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
appUpdateManager.startUpdateFlowForResult(it, AppUpdateType.FLEXIBLE, this, 2);
}else{
toast("Not Available")
}
}
最佳答案
在再次彻底阅读文档之前,我为同样的问题苦苦挣扎了几天。阅读 this section在应用内更新的官方文档中。
该链接描述了正确的测试程序,如下所示:
- On your test device, make sure you've already installed a version of your app that meets the following requirements:
- Follow the Play Console instructions on how to share your app internally. Make sure you upload a version of your app that uses a version code that's higher than the one you have already installed on the test device.
- On the test device, only click the internal app-sharing link for the updated version of your app. Do not install the app from the Google Play Store page you see after clicking the link.
- Open the app from the device's app drawer or home screen. The update should now be available to your app, and you can test your implementation of in-app updates.
这也非常有用,因为您不必等待应用程序发布,您可以立即开始测试。
关于android - 在调试设备上测试时显示 UPDATE_NOT_AVAILABLE 的应用内更新 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56118563/