public abstract class PermissionRequestManager
extends java.lang.Object
Any PermissionRequest should be added to the PermissionRequestManager during Application.onCreate()
The PermissionRequest objects are then presented in PermissionStepLayout
for denile /
approval
Modifier and Type | Class and Description |
---|---|
static class |
PermissionRequestManager.PermissionRequest
Class represents a permission that the user needs to grant
|
Modifier and Type | Field and Description |
---|---|
static int |
PERMISSION_REQUEST_CODE
Request code for handling a system permission on 6.0+
|
Constructor and Description |
---|
PermissionRequestManager() |
Modifier and Type | Method and Description |
---|---|
void |
addPermission(PermissionRequestManager.PermissionRequest permissionRequest)
Adds a PermissionRequest to the internal storage map.
|
void |
addPermissions(java.util.Collection<PermissionRequestManager.PermissionRequest> permissionRequests)
Bulk add of PermissionRequests
|
void |
addPermissions(PermissionRequestManager.PermissionRequest... permissionRequests)
Bulk add of PermissionRequests
|
static PermissionRequestManager |
getInstance()
Returns a singleton static instance of the this class
|
java.util.List<PermissionRequestManager.PermissionRequest> |
getPermissionRequests()
Returns a list of permission requests
|
abstract boolean |
hasPermission(android.content.Context context,
java.lang.String permissionId)
Method is used to check if a permission has been granted for a specific permission.
|
static void |
init(PermissionRequestManager manager)
Initializes the UiManager singleton.
|
boolean |
isNonSystemPermission(java.lang.String permissionId)
Checks if the permission exists in the internal map and returns true if the permission is not
handled by the system.
|
abstract boolean |
onNonSystemPermissionResult(android.app.Activity activity,
int requestCode,
int resultCode,
android.content.Intent data)
This method is called for handling the result of a non-system permission.
|
abstract void |
onRequestNonSystemPermission(android.app.Activity activity,
java.lang.String id)
This method is called when a non-system permission needs to go through a grant flow.
|
void |
setPermissionRequests(java.util.List<PermissionRequestManager.PermissionRequest> permissionRequests)
Clears the internal map where PermissionRequests are stored and adds the requests that are
passed in
|
public static final int PERMISSION_REQUEST_CODE
public static void init(PermissionRequestManager manager)
Application.onCreate()
method.manager
- an implementation of ResourcePathManagerpublic static PermissionRequestManager getInstance()
public java.util.List<PermissionRequestManager.PermissionRequest> getPermissionRequests()
public void setPermissionRequests(java.util.List<PermissionRequestManager.PermissionRequest> permissionRequests)
permissionRequests
- list of permission requestspublic void addPermissions(java.util.Collection<PermissionRequestManager.PermissionRequest> permissionRequests)
permissionRequests
- collection of PermissionRequestspublic void addPermissions(PermissionRequestManager.PermissionRequest... permissionRequests)
permissionRequests
- array of PermissionRequestspublic void addPermission(PermissionRequestManager.PermissionRequest permissionRequest)
permissionRequest
- the permission you seek to be grantedpublic boolean isNonSystemPermission(java.lang.String permissionId)
permissionId
- the ID of the PermissionRequestpublic abstract boolean hasPermission(android.content.Context context, java.lang.String permissionId)
ContextCompat.checkSelfPermission(android.content.Context, java.lang.String)
for system permissions.context
- android contextpermissionId
- the ID of the PermissionRequestpublic abstract void onRequestNonSystemPermission(android.app.Activity activity, java.lang.String id)
Activity.startActivityForResult(Intent, int)
activity
- the calling activity for when you request a non-system permissionid
- the id of the permissionpublic abstract boolean onNonSystemPermissionResult(android.app.Activity activity, int requestCode, int resultCode, android.content.Intent data)
activity
- the receiving activity of the permission resultrequestCode
- the request code from Activity.onActivityResult(int, int, Intent)
resultCode
- the result code from Activity.onActivityResult(int, int, Intent)
data
- the intent from Activity.onActivityResult(int, int, Intent)