4

I have implemented below code into my application but there is error while calling InAppUpdate code.

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()
                    }
                }
            }
        }

Error raise while calling the InAppUpdate module:

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!
Mahesh Keshvala
  • 1,349
  • 12
  • 19
  • 1
    Same issue here. It correctly works on some devices, but not on others (for example, on a Samsung smartphone with Android 8). In my case, neither the addOnFailureListener and onActivityResult callbacks are called, opposed to what the documentation says. – Riccardo Leschiutta Sep 30 '20 at 11:10
  • Same issue here, I was on a Pixel3a API30 emulator, I changed it for a Pixel 4 API 30 emulator and I ended up making it work, without any other change. – Renaud Boulard Jan 21 '21 at 14:07

0 Answers0