openharmony 鸿蒙 determine-application-mode

2025-06-12 浏览 (1)

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 TypeAuthorization ModeOperation Path
Open system_grant permissionsystem_grantDeclare permission > Access API
Open user_grant permissionuser_grantDeclare permission > Request user authorization > Access API
system_grant permission available for system applications via ACL
Restricted permission
system_grantRequest restricted permission > Declare permission > Access API
user_grant permission available for system applications via ACL
Restricted permission
user_grantRequest 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 APLAuthorization ModeEnable via ACLOperation Path
normal or system_basicsystem_grant-Declare permission > Access API
normal or system_basicuser_grant-Declare permission > Request user authorization > Access API
system_coresystem_granttrueRequest restricted permission > Declare permission > Access API
system_coreuser_granttrueRequest 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

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/C0shWm