# ActivityCompat.PermissionCompatDelegate

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/app/ActivityCompat.PermissionCompatDelegate "View this page in Java")

<br />

```
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 functions                                 |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [onActivityResult](https://developer.android.com/reference/kotlin/androidx/core/app/ActivityCompat.PermissionCompatDelegate#onActivityResult(android.app.Activity,int,int,android.content.Intent))`(` ` activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html)`,` ` requestCode: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` resultCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` data: `[Intent](https://developer.android.com/reference/android/content/Intent.html)`?` `)` Determines whether the delegate should handle the permission request as part of`FragmentActivity#onActivityResult(int, int, Intent)`.                                                                                                                |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [requestPermissions](https://developer.android.com/reference/kotlin/androidx/core/app/ActivityCompat.PermissionCompatDelegate#requestPermissions(android.app.Activity,java.lang.String[],int))`(` ` activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html)`,` ` permissions: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>,` ` requestCode: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Determines whether the delegate should handle[requestPermissions](https://developer.android.com/reference/kotlin/androidx/core/app/ActivityCompat#requestPermissions(android.app.Activity,java.lang.String[],int)), and request permissions if applicable. |

## Public functions

### onActivityResult

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

```
fun onActivityResult(
    activity: Activity,
    requestCode: @IntRange(from = 0) Int,
    resultCode: Int,
    data: Intent?
): Boolean
```

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                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| `activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                                                                                       | The target Activity.                                                                                                           |
| `requestCode: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The integer request code originally supplied to`startActivityForResult()`, allowing you to identify who this result came from. |
| `resultCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                       | The integer result code returned by the child activity through its setResult()}.                                               |
| `data: `[Intent](https://developer.android.com/reference/android/content/Intent.html)`?`                                                                                                        | An Intent, which can return result data to the caller (various data can be attached to Intent "extras").                       |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the delegate has handled the activity result. |

|                                                                               See also                                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [requestPermissions](https://developer.android.com/reference/kotlin/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)  

```
fun requestPermissions(
    activity: Activity,
    permissions: Array<String!>,
    requestCode: @IntRange(from = 0) Int
): Boolean
```

Determines whether the delegate should handle[requestPermissions](https://developer.android.com/reference/kotlin/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                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `activity: `[Activity](https://developer.android.com/reference/android/app/Activity.html)                                                                                                       | The target activity.                                                                                                                                                                                                                                                                            |
| `permissions: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>`          | The requested permissions. Must be non-null and not empty.                                                                                                                                                                                                                                      |
| `requestCode: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Application specific request code to match with a result reported to[onRequestPermissionsResult](https://developer.android.com/reference/kotlin/androidx/core/app/ActivityCompat.OnRequestPermissionsResultCallback#onRequestPermissionsResult(int,java.lang.String[],int[])). Should be \>= 0. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the delegate has handled the permission request. |

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