# ActivityCompat.PermissionCompatDelegate

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/app/ActivityCompat.java+class:androidx.core.app.ActivityCompat.PermissionCompatDelegate) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public interface ActivityCompat.PermissionCompatDelegate
```

<br />

*** ** * ** ***

Customizable delegate that allows delegating permission compatibility methods to a custom implementation.

To delegate permission compatibility methods to a custom class, implement this interface, and call `ActivityCompat.setPermissionCompatDelegate(delegate);`. All future calls to the permission compatibility methods in this class will first check whether the delegate can handle the method call, and invoke the corresponding method if it can.

## Summary

| ### Public methods |
|---|---|
| `abstract boolean` | `[onActivityResult](https://developer.android.com/reference/androidx/core/app/ActivityCompat.PermissionCompatDelegate#onActivityResult(android.app.Activity,int,int,android.content.Intent))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int requestCode, int resultCode, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html data )` **This method is deprecated.** This method is no longer called from `FragmentActivity`. <br /> |
| `abstract boolean` | `https://developer.android.com/reference/androidx/core/app/ActivityCompat.PermissionCompatDelegate#requestPermissions(android.app.Activity,java.lang.String[],int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html String[] permissions, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int requestCode )` Determines whether the delegate should handle `https://developer.android.com/reference/androidx/core/app/ActivityCompat#requestPermissions(android.app.Activity,java.lang.String[],int)`, and request permissions if applicable. |

## Public methods

### onActivityResult

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.18.0](https://developer.android.com/jetpack/androidx/releases/core#1.18.0)

```
abstract boolean [onActivityResult](https://developer.android.com/reference/androidx/core/app/ActivityCompat.PermissionCompatDelegate#onActivityResult(android.app.Activity,int,int,android.content.Intent))(
    @NonNull Activity activity,
    @IntRange(from = 0) int requestCode,
    int resultCode,
    @Nullable Intent data
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> This method is no longer called from `FragmentActivity`. Clients should migrate to [`ActivityResult` APIs](https://developer.android.com/training/basics/intents/result#register), specifically `https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.RequestPermission`.

Determines whether the delegate should handle the permission request as part of `FragmentActivity#onActivityResult(int, int, Intent)`. If this method returns true, it means that activity result is successfully handled by the delegate, and no further action is needed on this activity result.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity` | The target Activity. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int requestCode` | The integer request code originally supplied to `startActivityForResult()`, allowing you to identify who this result came from. |
| `int resultCode` | The integer result code returned by the child activity through its setResult()}. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/Intent.html data` | An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). |

| Returns |
|---|---|
| `boolean` | Whether the delegate has handled the activity result. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/ActivityCompat#requestPermissions(android.app.Activity,java.lang.String[],int)` |   |

### requestPermissions

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
abstract boolean requestPermissions(
    @NonNull Activity activity,
    @NonNull String[] permissions,
    @IntRange(from = 0) int requestCode
)
```

Determines whether the delegate should handle `https://developer.android.com/reference/androidx/core/app/ActivityCompat#requestPermissions(android.app.Activity,java.lang.String[],int)`, and request permissions if applicable. If this method returns true, it means that permission request is successfully handled by the delegate, and platform should not perform any further requests for permission.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Activity.html activity` | The target activity. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html String[] permissions` | The requested permissions. Must be non-null and not empty. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int requestCode` | Application specific request code to match with a result reported to `https://developer.android.com/reference/androidx/core/app/ActivityCompat.OnRequestPermissionsResultCallback#onRequestPermissionsResult(int,java.lang.String[],int[])`. Should be \>= 0. |

| Returns |
|---|---|
| `boolean` | Whether the delegate has handled the permission request. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/ActivityCompat#requestPermissions(android.app.Activity,java.lang.String[],int)` |   |