Jayshil Dave
Jayshil Dave

Reputation: 1236

Using InApp Update API mode Flexible

I was using In App Update API with update type as Flexible using below code

                    appUpdateManager.startUpdateFlowForResult(
                            appUpdateInfo,
                            AppUpdateType.FLEXIBLE,
                            this,
                            APP_UPDATE_REQUEST_CODE)

Where the update type is provided as AppUpdateType.FLEXIBLE. It showcases the correct UI where it provides option for users to either select Update or No Thanks. As showcased in below image. enter image description here

However clicking on Update actually showcases a fullscreen UI with progressbar generally associated with Immediate updated instead of performing the update in background.

Using play code SDK version 1.8.X

// Rate this app
// So, make sure you also include that repository in your project's build.gradle file.
implementation 'com.google.android.play:core:1.8.0'
// For Kotlin users also import the Kotlin extensions library for Play Core:
implementation 'com.google.android.play:core-ktx:1.8.1'

Does anyone has a idea why this would be happening?

Thanks in Advance.

Upvotes: 0

Views: 231

Answers (1)

hwwi
hwwi

Reputation: 11

Maybe your problem is

override fun onResume() {
    super.onResume()
    appUpdateManager
        .appUpdateInfo
        .addOnSuccessListener {
            // If an in-app update is already running, resume the update.
            if (it.updateAvailability() == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS)
                startUpdate(it, AppUpdateType.IMMEDIATE) // <<-- !!HERE!!
            // If the update is downloaded but not installed, notify the user to complete the update.
            if (it.installStatus == InstallStatus.DOWNLOADED) {
                nav_progress_download.hide()
                popupSnackbarForCompleteUpdate()
            }
        }
}

When you click Update button, onResume is called. And updateAvailability() of AppUpdateType.FLEXIBLE is same as UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS

Check this...

How to know the AppUpdateType at the origin of the DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS update availability?

https://issuetracker.google.com/issues/153785560

Upvotes: 1

Related Questions