Код: Выделить всё
fun openDownloadedFile(context: Context?, fileName: String) {
val storageDirectory =
Environment.getExternalStorageDirectory().toString() + STORAGE_DIRECTORY + "/${fileName}"
val file = File(storageDirectory)
if (file.exists()) {
val downloadedFileUri = Uri.fromFile(file)
val fileIntent = Intent(Intent.ACTION_VIEW)
fileIntent.setDataAndType(downloadedFileUri, "application/vnd.android.package-archive")
fileIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
context?.startActivity(fileIntent)
}
}
Код: Выделить всё
android:name="androidx.core.content.FileProvider"
android:authorities="net.mytvplus.stbstore.file_provider"
android:exported="false"
android:grantUriPermissions="true">
Код: Выделить всё
android.os. FileUriExposeException:
file:///storage/emulated/0/Download/FileNmae доступен за пределами приложения
через Intent.getData()
Любая помощь?
Подробнее здесь: https://stackoverflow.com/questions/764 ... d-filenmae