I am using in-app updates for android and as per the documentation, they are using onActivityResult to handle app behaviour incase the update is interrupted.
This is my function that is called from my fragment:
private fun startImmediateUpdate(appUpdateInfo: AppUpdateInfo) {
appUpdateManager.startUpdateFlowForResult(
appUpdateInfo,
AppUpdateType.IMMEDIATE,
requireActivity(),
Constants.CODES.APP_UPDATE_REQUEST_CODE
)
}
This is how i am handling results in parent activity
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
Constants.CODES.APP_UPDATE_REQUEST_CODE -> {
if (resultCode != RESULT_OK || resultCode == RESULT_CANCELED || resultCode == ActivityResult.RESULT_IN_APP_UPDATE_FAILED) {
//Do whatever i want to
}
}
}
super.onActivityResult(requestCode, resultCode, data)
}
Now super.onActivityResult(requestCode, resultCode, data) is deprecated. Things are working fine for now but i am worried the app will crash if its wiped out completely
What can i do to replace onActivityResult()? I have looked into registerForActivityResult() but could not find anything that suits my usecase.
I have the same issue and I see that one possibility is to rewrite to use the startUpdateFlow call instead.
Personally, I think this is not worth doing, so I will ignore this specific deprecation warning instead and wait/hope for Android/Google to make a method where we can pass an ActivityResultLauncher
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With