ActivityCompat.PermissionCompatDelegate
public interface ActivityCompat.PermissionCompatDelegate
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(Determines whether the delegate should handle the permission request as part of |
abstract boolean |
requestPermissions(Determines whether the delegate should handle |
Public methods
onActivityResult
abstract boolean onActivityResult(
@NonNull Activity activity,
@IntRange(from = 0) int requestCode,
int resultCode,
@Nullable Intent data
)
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 | |
|---|---|
@NonNull Activity activity |
The target Activity. |
@IntRange(from = 0) int requestCode |
The integer request code originally supplied to |
int resultCode |
The integer result code returned by the child activity through its setResult()}. |
@Nullable Intent 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 | |
|---|---|
requestPermissions |
requestPermissions
abstract boolean requestPermissions(
@NonNull Activity activity,
@NonNull String[] permissions,
@IntRange(from = 0) int requestCode
)
Determines whether the delegate should handle requestPermissions, 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 | |
|---|---|
@NonNull Activity activity |
The target activity. |
@NonNull String[] permissions |
The requested permissions. Must be non-null and not empty. |
@IntRange(from = 0) int requestCode |
Application specific request code to match with a result reported to |
| Returns | |
|---|---|
boolean |
Whether the delegate has handled the permission request. |
| See also | |
|---|---|
requestPermissions |