Stay organized with collections
Save and categorize content based on your preferences.
FileUriExposedException
open class FileUriExposedException : RuntimeException
The exception that is thrown when an application exposes a file://
android.net.Uri
to another app.
This exposure is discouraged since the receiving app may not have access to the shared path. For example, the receiving app may not have requested the android.Manifest.permission#READ_EXTERNAL_STORAGE
runtime permission, or the platform may be sharing the android.net.Uri
across user profile boundaries.
Instead, apps should use content://
Uris so the platform can extend temporary permission for the receiving app to access the resource.
This is only thrown for applications targeting Build.VERSION_CODES.N
or higher. Applications targeting earlier SDK versions are allowed to share file://
android.net.Uri
, but it's strongly discouraged.
Summary
Public constructors
FileUriExposedException
FileUriExposedException(message: String!)
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# FileUriExposedException\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nFileUriExposedException\n=======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/os/FileUriExposedException \"View this page in Java\") \n\n```\nopen class FileUriExposedException : RuntimeException\n```\n\n|---|---|---|---|-----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||||\n| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) ||||\n| | ↳ | [java.lang.Exception](../../java/lang/Exception.html#) |||\n| | | ↳ | [java.lang.RuntimeException](../../java/lang/RuntimeException.html#) ||\n| | | | ↳ | [android.os.FileUriExposedException](#) |\n\nThe exception that is thrown when an application exposes a `file://` [android.net.Uri](../net/Uri.html#) to another app.\n\nThis exposure is discouraged since the receiving app may not have access to the shared path. For example, the receiving app may not have requested the [android.Manifest.permission#READ_EXTERNAL_STORAGE](../Manifest.permission.html#READ_EXTERNAL_STORAGE:kotlin.String) runtime permission, or the platform may be sharing the [android.net.Uri](../net/Uri.html#) across user profile boundaries.\n\nInstead, apps should use `content://` Uris so the platform can extend temporary permission for the receiving app to access the resource.\n\nThis is only thrown for applications targeting [Build.VERSION_CODES.N](/reference/kotlin/android/os/Build.VERSION_CODES#N:kotlin.Int) or higher. Applications targeting earlier SDK versions are allowed to share `file://` [android.net.Uri](../net/Uri.html#), but it's strongly discouraged.\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [FileUriExposedException](#FileUriExposedException(kotlin.String))`(`message:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` \u003cbr /\u003e |\n\nPublic constructors\n-------------------\n\n### FileUriExposedException\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nFileUriExposedException(message: String!)\n```"]]