android - 在调试设备上测试时显示 UPDATE_NOT_AVAILABLE 的应用内更新 API

标签 android kotlin google-play in-app-update google-play-core

我正在尝试集成新的应用内更新 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.


  • 在已连接设备上安装 Apk 时,如何在 Debug模式下使用相同的签名 key 进行签名?

  • If the app you are testing doesn’t appear with an available update, check that you’ve properly set up your testing tracks.


  • 是否必须在内部测试轨道发布 App 以测试实现?

  • 无论如何,我只想在我的设备上进行测试,我从 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在应用内更新的官方文档中。
    该链接描述了正确的测试程序,如下所示:

    1. On your test device, make sure you've already installed a version of your app that meets the following requirements:

  • 该应用是使用内部应用共享 URL
  • 安装的
  • 支持应用内更新
  • 使用低于应用程序更新版本的版本代码

    1. 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.
    2. 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.
    3. 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/

    相关文章:

    android - 使用 SurfaceView 居中裁剪 Exoplayer

    c# - Xamarin.Forms 不可点击的 ListView(移除选择涟漪效应)

    java - 使用 spring data mongodb 和 kotlin 更新对象不起作用

    java - Kotlin:接口(interface)......没有构造函数

    android - Google 重置 key 后如何更新 Android 应用程序

    Android:您如何知道您的应用程序何时可搜索并显示在 Google Play 中?

    android - 无法按标题搜索Android应用-仅按包名称搜索

    android - Android Studio:添加aws-java-sdk会导致超出GC开销限制

    javascript - Kotlin JS JSON 反序列化

    android - Node.js - null 但已授权