I am trying to integrate the new In-App Update API but I cannot able to test it's implementation. Seems like my code is fine therefore I read the Troubleshoots and am not able to understand 2 points in this document

Make sure that the app that you are testing is signed with the same signing key as the one available from Google Play.

  1. 在连接的设备上安装APK时,如何在调试模式下使用相同的签名密钥签名?

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

  1. Is it compulsory to release App in internal testing tracks to test implementation?

Anyway I just want to test on my device and I decremented the version code from the play store version but its showing always 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")
    }
}

推荐答案

I struggled with this same problem for a few days before once again going through the documentation thoroughly. Read this section on the official documentation of the in-app updates.

The link describes the correct testing procedure as follows:

  1. On your test device, make sure you've already installed a version of your app that meets the following requirements:
  • 该应用程序是使用内部应用程序共享URL安装的
  • 支持应用内更新
  • Uses a version code that's lower than the updated version of your app
  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. 在测试设备上,仅单击应用程序更新版本的内部应用程序共享链接.不要从点击链接后看到的Google Play Store页面安装应用程序.
  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.

This is also super helpful because you don't have to wait for the app to be published, you can start testing immediately.

Kotlin相关问答推荐

Jetpack Compose Material3和Material2 Slider onValueChangeFinded()的行为不同

如何接受任何派生类KClass

Kotlin中一个接口的实现问题

合并状态流

限制通用Kotlin枚举为特定类型

如何将消费者放入 Kotlin 的 map 中?

列表在 android WebView 中没有正确迭代

找不到有效的 Docker 环境

Kotlin 接口类型参数

Kotlin 中的 maxOf() 和 max() 方法有什么区别?

为什么 KFunction2 在 Kotlin 中不是可表示类型?

使用 LazyListScope 嵌套可组合项

为什么 IntelliJ Idea 无法识别我的 Spek 测试?

为什么 Dialog 没有 NavController [Missing]?

launch 仅从 Kotlin 1.3 开始可用,不能在 Kotlin 1.2 中使用

如何暂停kotlin coroutine直到收到通知

Jetpack Compose-居中文本

WebFlux 功能:如何检测空 Flux 并返回 404?

java.lang.NoClassDefFoundError:解析失败:Lkotlin/time/MonoClock

Kotlin:如何使用扩展函数扩展枚举类