Skip to content

Most visited

Recently visited

navigation
added in version 27.0.0
belongs to Maven artifact com.android.support:support-compat:27.0.0

ActivityCompat.PermissionCompatDelegate

public static interface ActivityCompat.PermissionCompatDelegate

android.support.v4.app.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(Activity activity, int requestCode, int resultCode, Intent data)

Determines whether the delegate should handle the permission request as part of FragmentActivity#onActivityResult(int, int, Intent).

abstract boolean requestPermissions(Activity activity, String[] permissions, int requestCode)

Determines whether the delegate should handle requestPermissions(Activity, String[], int), and request permissions if applicable.

Public methods

onActivityResult

added in version 27.0.0
boolean onActivityResult (Activity activity, 
                int requestCode, 
                int resultCode, 
                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
activity Activity: The target Activity.

requestCode int: The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.

resultCode int: The integer result code returned by the child activity through its setResult()}.

data Intent: 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

added in version 27.0.0
boolean requestPermissions (Activity activity, 
                String[] permissions, 
                int requestCode)

Determines whether the delegate should handle requestPermissions(Activity, 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: The target activity.

permissions String: The requested permissions. Must me non-null and not empty.

requestCode int: Application specific request code to match with a result reported to onRequestPermissionsResult(int, String[], int[]). Should be >= 0.

Returns
boolean Whether the delegate has handled the permission request.

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)