# 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)
public final 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/androidx/appfunctions/AppFunctionUriGrant#uri()` along with the specific access `https://developer.android.com/reference/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/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/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/androidx/appfunctions/AppFunctionUriGrant#AppFunctionUriGrant(android.net.Uri,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html uri, int modeFlags)` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionUriGrant#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final int` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionUriGrant#getModeFlags()()` The access mode flags. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionUriGrant#getUri()()` The `https://developer.android.com/reference/android/net/Uri.html` to be granted. |
| `int` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionUriGrant#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionUriGrant#toString()()` |

## Public constructors

### AppFunctionUriGrant

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

```
public AppFunctionUriGrant(@NonNull Uri uri, int modeFlags)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

### getModeFlags

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

```
public final int getModeFlags()
```

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`.

### getUri

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

```
public final @NonNull Uri getUri()
```

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

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```