I am using this code but my onActivityResult never gets called. I used to make the request without passing the extra intent to save the image to an SD card and that worked f
In my case, the onDestroy called instead. Because android system will try to release memory (if our apps in background, and we open camera apps), and the reason it never called onActivityResult method also due to this please make sure you were not using noHistory=true or intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
e.g
// AbcActivity.kt
val intent = Intent(AbcActivity.this, RegistrationForm.class)
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
startActivity(intent)
// RegistrationForm.kt
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
// do take pictures, and confirm the photo, never going back to the RegistrationForm, instead back to AbcActivity
by removing flags and noHistory=true (in AndroidManifest.xml) my activity recreated and onActivityResult called again, but we need to save the previous state using ViewModel or (onSaveInstance & onRestoreInstance)