harmony 鸿蒙Workflow for Requesting Permissions

  • 2025-06-12
  • 浏览 (3)

Workflow for Requesting Permissions

You need to determine whether your application needs related permissions before accessing data or performing an operation. If permissions are required, request the permissions in the application installation package.

The procedure for requesting a permission varies depending on the permission level and authorization mode. Before requesting a permission, you need to:

  1. Determine the permission type in the related permission list.
  2. Request the permission by following the corresponding operation path.

Requesting Permissions for normal Applications

Permission Type Authorization Mode Operation Path
Open system_grant permission system_grant Declare permission > Access API
Open user_grant permission user_grant Declare permission > Request user authorization > Access API
system_grant permission available for system applications via ACL
Restricted permission
system_grant Request restricted permission > Declare permission > Access API
user_grant permission available for system applications via ACL
Restricted permission
user_grant Request restricted permission > Declare permission > Request user authorization > Access API

NOTE

  • A normal application cannot request a system_basic permission whose Enable via ACL is false.
  • You can use DevEco Studio to request a permission via ACL. However, this approach applies to the applications in debug phase, but not to the applications to be released to an app market. For a commercial application, apply for a release certificate and profile in the app market.

Requesting Permissions for system_basic Applications

Permission APL Authorization Mode Enable via ACL Operation Path
normal or system_basic system_grant - Declare permission > Access API
normal or system_basic user_grant - Declare permission > Request user authorization > Access API
system_core system_grant true Request restricted permission > Declare permission > Access API
system_core user_grant true Request restricted permission > Declare permission > Request user authorization > Access API

To change the application APL to system_basic or system_core, modify the HarmonyAppProvision file (Toolchains / _{Version} _/ lib / UnsgnedReleasedProfileTemplate.json file in the SDK directory) of the application when developing the application installation package, and sign the application again.

Example

Modify the “bundle-info” > “apl” field in the file.

"bundle-info" : {
    // ...
    "apl": "system_basic",
    // ...
},

NOTE Modifying the HarmonyAppProvision configuration file applies to the applications in the debug phase, but not to the applications released to the app market. For a commercial application, apply for a release certificate and profile in the app market.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Application Access Control

harmony 鸿蒙Access Control Overview

harmony 鸿蒙Application Permission Groups

harmony 鸿蒙Application Permission Management Overview

harmony 鸿蒙Application Permissions

harmony 鸿蒙Requesting Restricted Permissions

harmony 鸿蒙Declaring Permissions

harmony 鸿蒙Requesting One-Time User Authorization

harmony 鸿蒙Using PasteButton

harmony 鸿蒙Open user_grant Permissions

0  赞