FOR MODERATORS: I know there are already questions like this but all of those approaches endup giving bitmap through data.getExtra("data") which is actually just thumbnail. I want to get URI not bitmap and I need to get URI of ACTUAL IMAGE not its thumbnail with approach available in 2021. PLEASE CONSIDER THIS BEFORE TAGGING QUESTION AS DUPLICATE!
I am getting image from camera and its working fine on lower devices but its giving null in data when onActivityResult is called only in Android 10 and 11.
That's what I am doing
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
startActivityForResult(intent, ACTION_REQUEST_CAMERA)
Here is my onActivityResult
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK && requestCode == ACTION_REQUEST_CAMERA) {
data?.data?.let { uri ->
Toast.makeText(context, "Got URI", Toast.LENGTH_LONG).show()
}
}
}