Hello, I am using the In-App Update feature in And...
# android
e
Hello, I am using the In-App Update feature in Android (Immediate Update). We already have a method of
Copy code
appUpdateManager.startUpdateFlowForResult(
    info,
    AppUpdateType.IMMEDIATE,
    parentActivity,
    MY_REQUEST_CODE
)
Which triggers the Immediate flow. If you observe here we are passing here the MY_REQUEST_CODE while triggering Update. Once the update is Finished, Cancel we get the callback in OnActivityResult based on that we can take decisions. But we already know onActivityResult is deprecated now and it is recommended to use the Activity Result Api which has a code like
Copy code
var resultLauncher =
    registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
        if (result.resultCode == Activity.RESULT_OK) {
            // There are no request codes
            val data: Intent? = result.data
            inAppUpdate?.let {
                inAppUpdate?.onActivityResult(result.resultCode, data)
            }
        } else if (result.resultCode == AppCompatActivity.RESULT_CANCELED) {
            finish()
        }
    }
But How to get the request code in this case ??? Can anyone help here ? Thread in #android
4