INNER CODE UNIT · Kotlin
requestStorageAccess
romanvht/ByeByeDPI · app/src/main/java/io/github/romanvht/byedpi/activities/FileActivity.kt:256
private fun requestStorageAccess() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
externalRequestActive = true
try {
storageAccessLauncher.launch(PermissionUtils.storageAccessIntent(this))
} catch (exception: Exception) {
Log.e(TAG, "Failed to open app storage access settings", exception)
try {
storageAccessLauncher.launch(PermissionUtils.storageAccessFallbackIntent())
} catch (fallbackException: Exception) {
Log.e(TAG, "Failed to open storage access settings", fallbackException)
externalRequestActive = false
Toast.makeText(
this,
R.string.storage_access_not_granted,
Toast.LENGTH_SHORT
).show()
finish()