public interface PermissionManager
PermissionManager
WikitudeSDK.getPermissionManager()
can be used.
Usage:
WikitudeSDK.getPermissionManager().checkPermissions(activity, new String[]{Manifest.permission.CAMERA}, PermissionManager.WIKITUDE_PERMISSION_REQUEST, permissionManagerCallback);
// This has to be done in the activity that is passed to checkPermission
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
WikitudeSDK.getPermissionManager().onRequestPermissionsResult(requestCode, permissions, grantResults);
}
Modifier and Type | Interface and Description |
---|---|
static interface |
PermissionManager.PermissionManagerCallback
Callbacks of the PermissionManager.
It can be used to define what happens on the following events: PermissionManager.PermissionManagerCallback.permissionsGranted(int requestCode)
PermissionManager.PermissionManagerCallback.permissionsDenied(String[])
PermissionManager.PermissionManagerCallback.showPermissionRationale(int, String[])
|
Modifier and Type | Field and Description |
---|---|
static int |
WIKITUDE_PERMISSION_REQUEST |
Modifier and Type | Method and Description |
---|---|
void |
checkPermissions(android.app.Activity activity,
String[] permissions,
int requestCode,
PermissionManager.PermissionManagerCallback permissionManagerCallback)
Checks it the requested permissions are granted and requests missing permissions.
|
void |
onRequestPermissionsResult(int requestCode,
String[] permissions,
int[] grantResults)
This needs to be called in the
Activity.onRequestPermissionsResult(int, java.lang.String[], int[]) to pass the result to the Wikitude SDK. |
void |
positiveRationaleResult(int requestCode,
String[] permissions)
This needs to be called if the user decides to grant the permissions after they were denied before.
|
static final int WIKITUDE_PERMISSION_REQUEST
void checkPermissions(android.app.Activity activity, String[] permissions, int requestCode, PermissionManager.PermissionManagerCallback permissionManagerCallback)
activity
- The Activity
which overrides the Activity.onRequestPermissionsResult(int, java.lang.String[], int[])
.permissions
- The array containing one or more Manifest.permission
.requestCode
- Permission request identifier used to distinguish between different requests.permissionManagerCallback
- PermissionManager.PermissionManagerCallback
void positiveRationaleResult(int requestCode, String[] permissions)
requestCode
- The permission request identifier passed in checkPermissions(android.app.Activity, java.lang.String[], int, com.wikitude.common.permission.PermissionManager.PermissionManagerCallback)
.permissions
- Array containing one or more Manifest.permission
.void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
Activity.onRequestPermissionsResult(int, java.lang.String[], int[])
to pass the result to the Wikitude SDK.requestCode
- The permission request identifier passed in checkPermissions(android.app.Activity, java.lang.String[], int, com.wikitude.common.permission.PermissionManager.PermissionManagerCallback)
.permissions
- Array containing one or more Manifest.permission
.grantResults
- Array containing if those permissions were granted or denied.