PMS
This module provides interfaces for managing permissions of third-party applications.
Since:
1.0
Version:
1.0
Summary
Files
Functions
Checks whether the caller (generally a third-party application) has a specified permission of a system service API. |
|
QueryPermission (const char identifier, *permissions, int permNum) |
Queries all permissions requested by the application and checks whether these permissions are granted. |
GrantPermission (const char identifier, const char permName) |
|
GrantRuntimePermission (int taskID, const char permissionName) |
|
Function Documentation
CheckPermission()
Description:
Checks whether the caller (generally a third-party application) has a specified permission of a system service API.
Parameters:
Returns:
Returns 1 if the caller has the permission; returns 0 otherwise.
GrantPermission()
Description:
Grants a specified permission to the application.
Parameters:
identifier | Indicates the pointer to the application bundle name. |
permName | Indicates the pointer to the permission name. For details, see the developer documentation. |
Returns:
Returns 0 if the permission is successfully granted; returns an error code defined in otherwise.
Description:
Grants a specified runtime permission to an application.
This function applies to sensitive permissions that can be granted to the application only when the application is running.
Parameters:
Returns:
Returns 0 if the permission is successfully granted; returns an error code defined in otherwise.
QueryPermission()
Description:
Queries all permissions requested by the application and checks whether these permissions are granted.
Parameters:
identifier | Indicates the pointer to the application bundle name. |
permissions | Indicates the double pointer to the array of permissions. You need to pass the PermissionSaved pointer and release it after finishing using it. |
permNum | Indicates the pointer to the number of permissions in the array, which is an integer. |
Returns:
Returns 0 if the operation is successful; returns an error code defined in otherwise.
RequestPermission()
Description:
Requests a specified permission.
Parameters:
Returns:
Returns 0 if the operation is successful; returns an error code defined in PmsErrorCode otherwise.
RevokePermission()
Description:
Revokes a specified permission from the application.
Parameters:
identifier | Indicates the pointer to the application bundle name. |
permName | Indicates the pointer to the permission name. For details, see the developer documentation. |
Returns:
Returns 0 if the permission is successfully revoked; returns an error code defined in otherwise.