InAppUpdater icon indicating copy to clipboard operation
InAppUpdater copied to clipboard

[BUG] force update closing on back button.

Open onirban27 opened this issue 4 years ago • 3 comments

Describe the bug force update is closing when hardware back button is pressed. To Reproduce Steps to reproduce the behavior:

  1. trigger force update
  2. Click on back button
  3. force update window closes.

Expected behavior force update is needed so that old version are updated forcefully. user can still close the window and use old version.

Additional context my main activity has onBackPress() which helps user to exit app for twice clicks.

onirban27 avatar Mar 08 '20 07:03 onirban27

You have to handle that in the onActivityResult method of your activity, that can't be controlled in the library.

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        when (requestCode) {
            UpdateManagerConstant.REQUEST_CODE -> {
                when(resultCode){
                    Activity.RESULT_OK -> {

                    }
                    Activity.RESULT_CANCELED -> {
                        if(updateMgr?.mode == UpdateManagerConstant.IMMEDIATE) finish()
                    }
                    ActivityResult.RESULT_IN_APP_UPDATE_FAILED -> {
                        
                    }
                }
            }
        }
    }

cmy82 avatar Feb 24 '21 18:02 cmy82

UpdateManagerConstant.REQUEST_CODE accessing this from the library it shows package private is not accessible.

mjjabarullah avatar Aug 05 '21 06:08 mjjabarullah

Unable to register updatemanger For Activity Result, moreover onActivityResult is deprecated now.

akhileshsharma avatar Jun 17 '22 01:06 akhileshsharma