Код: Выделить всё
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)
}
}
< /code>
Я также объявил поставщик файлов в файле manifest.xml < /p>
android:name="androidx.core.content.FileProvider"
android:authorities="net.mytvplus.stbstore.file_provider"
android:exported="false"
android:grantUriPermissions="true">
< /code>
file_provider.xml:
hore/anddroid.os.fileuriexposedException:
file: ////merualt/0/0/flenmae inpecated app (br/br/> intent.get. /> < /blockquote>
Любая помощь? < /p>
Подробнее здесь: https://stackoverflow.com/questions/764 ... d-filenmae
Мобильная версия