public class

Permission

extends Object
java.lang.Object
   ↳ com.davidluoye.support.app.Permission

Summary

Constants
String KEY_EXTRA
Public Constructors
Permission()
Public Methods
static int checkCallingPermission(String permission)
Determine whether the calling process of an IPC you are handling has been granted a particular permission.
static int checkPermission(String permission, int pid, int uid)
Determine whether the given permission is allowed for a particular process and user ID running in the system.
static int checkSelfPermission(String permission)
Determine whether you have been granted a particular permission.
static String[] getDeniedPermissions(String[] permissions)
Get the denied permissions
static boolean hasPermission(String permission)
static void requestPermission(Context context, String[] permissions)
Start a permission activity
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String KEY_EXTRA

Constant Value: "permission"

Public Constructors

public Permission ()

Public Methods

public static int checkCallingPermission (String permission)

Determine whether the calling process of an IPC you are handling has been granted a particular permission. This is basically the same as calling checkPermission(String, int, int) with the pid and uid returned by getCallingPid() and getCallingUid(). One important difference is that if you are not currently processing an IPC, this function will always fail. This is done to protect against accidentally leaking permissions;

Parameters
permission The name of the permission being checked.
Returns

public static int checkPermission (String permission, int pid, int uid)

Determine whether the given permission is allowed for a particular process and user ID running in the system.

Parameters
permission The name of the permission being checked.
pid The process ID being checked against. Must be > 0.
uid The user ID being checked against.

A uid of 0 is the root user, which will pass every permission check.

Returns

public static int checkSelfPermission (String permission)

Determine whether you have been granted a particular permission.

Parameters
permission The name of the permission being checked.
Returns

public static String[] getDeniedPermissions (String[] permissions)

Get the denied permissions

Parameters
permissions The name of the permissions being checked.
Returns
  • an array of permissions which has been denied.

public static boolean hasPermission (String permission)

public static void requestPermission (Context context, String[] permissions)

Start a permission activity

Parameters
permissions request permission array.