Intent(MediaStore.ACTION_VIDEO_CAPTURE).also { takeVideoIntent ->
takeVideoIntent.resolveActivity(packageManager)?.also {
startActivityForResult(takeVideoIntent, REQUEST_TAKE_VIDEO)
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_TAKE_VIDEO && resultCode == RESULT_OK) {
var videoUri = data?.data
val intent = Intent(this, AddActivity::class.java)
intent.putExtra(VIDEO_URI, videoUri);
startActivity(intent)
}
}
In the second Activity when I try to open the uri of the video in videoview I'm Getting this exeption:
java.io.FileNotFoundException: /storage/emulated/0/Movies/.pending-1648411601-VID_20220320_200641.mp4: open failed: EACCES (Permission denied)
I found a solution that solves the problem: adding to menifest MANAGE_EXTERNAL_STORAGE permission
But google play doesn't accept my app with this permission.
What are the alternatives if any?