# AppFunctionUriGrant

Artifact: [androidx.appfunctions:appfunctions](https://developer.android.com/jetpack/androidx/releases/appfunctions) [View Source](https://cs.android.com/search?q=file:androidx/appfunctions/AppFunctionUriGrant.kt+class:androidx.appfunctions.AppFunctionUriGrant) Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

*** ** * ** ***


```
@AppFunctionSerializable(isDescribedByKDoc = false)
class AppFunctionUriGrant
```

<br />

*** ** * ** ***

Represents a `https://developer.android.com/reference/android/net/Uri.html` for which temporary access permission is to be granted to the caller of an AppFunction execution.

This class encapsulates a `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#uri()` along with the specific access `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#modeFlags()` (e.g., `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION`) that define the type of temporary access to be granted for that URI.

Using this class in the `https://developer.android.com/reference/kotlin/androidx/appfunctions/ExecuteAppFunctionResponse.Success#returnValue()` is equivalent to calling `https://developer.android.com/reference/android/content/Context.html#grantUriPermission(java.lang.String, android.net.Uri, int)` for the agent that is executing the function.

To succeed, the content provider owning the Uri must have set the `grantUriPermissions` attribute in its manifest or included the `<grant-uri-permissions>` tag.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/ExecuteAppFunctionResponse.Success#returnValue()` |   |
| `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION` |   |
| `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION` |   |
| `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_PREFIX_URI_PERMISSION` |   |
| `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_PERSISTABLE_URI_PERMISSION` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#AppFunctionUriGrant(android.net.Uri,kotlin.Int)(uri: https://developer.android.com/reference/android/net/Uri.html, modeFlags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#modeFlags()` The access mode flags. |
| `https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/AppFunctionUriGrant#uri()` The `https://developer.android.com/reference/android/net/Uri.html` to be granted. |

## Public constructors

### AppFunctionUriGrant

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
AppFunctionUriGrant(uri: Uri, modeFlags: Int)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### modeFlags

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
val modeFlags: Int
```

The access mode flags.

This value must include at least one of `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION` or `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION`. It may optionally also include `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_PREFIX_URI_PERMISSION` or `https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_PERSISTABLE_URI_PERMISSION`.

Value is either `0` or a combination of the following:

- `1`
- `2`
- `128`
- `64`

<br />

### uri

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
val uri: Uri
```

The `https://developer.android.com/reference/android/net/Uri.html` to be granted.