目录

Preparations

Requesting Permissions

[h2]Scenario

Before using Network Boost Kit capabilities, check whether you have obtained corresponding permissions for your app. If your app has not been granted some permissions, you need to declare these permissions.

Specifically, Network Boost Kit requires the following permissions:

ohos.permission.GET_NETWORK_INFO: allows your app to request device network information.

ohos.permission.INTERNET: allows your app to access the Internet.

ohos.permission.LINKTURBO: allows your app to use the multi-network concurrency capability for network acceleration. APIs related to network handover require this permission. Request it only when necessary.

You must manually configure the preceding permissions before using the kit. For details, please refer to Procedure.

The ohos.permission.LINKTURBO permission is a restricted ACL permission that requires special configuration and request. For details, please refer to Configuring Signature Information and Requesting a Restricted ACL Permission.

[h2]Procedure

Configure the required permissions in the module.json5 file in entry/src/main. The sample code is as follows:

{
  "module": {
    "requestPermissions": [
      {
        "name": "ohos.permission.GET_NETWORK_INFO"
      },
      {
        "name": "ohos.permission.INTERNET"
      },
      {
        "name": "ohos.permission.LINKTURBO"
      }
    ]
  }
}

[h2]Preparations for C API Development

In addition to the aforementioned permission configuration, when using the C API, you also need to set the dynamic library path and header file path in CMakeLists.txt, and then link to them.

If the compilation target is entry, add the following commands:

target_include_directories(entry PUBLIC ${HMOS_SDK_NATIVE}/sysroot/usr/include)
target_link_directories(entry PUBLIC ${HMOS_SDK_NATIVE}/sysroot/usr/lib/aarch64-linux-ohos)
target_link_libraries(entry PUBLIC libnetwork_boost.so) # Link to **libnetwork_boost.so** and other depended SO files.

Configuring Signature Information

Requesting a Restricted ACL Permission

  1. When requesting a debug profile file and add permission information or requesting a release profile, the fourth step is mandatory. Set Permissions to request to Restricted ACL permissions and click Select.

  2. Enter ohos.permission.LINKTURBO in the search box, find and select the required permission, and click Submit.

  3. Enter the request reason based on your actual service requirements and submit the request. The request will be replied within one working day. You can view the request status in the interaction center.

  4. After the permission request is approved, view the permission on the Obtained tab page. Select the permission and click OK.

  5. Select the permission and click Add to generate a new profile. Download the profile and use it to replace the old one by referring to Signing Your App/Atomic Service Manually.

  6. Add the ohos.permission.LINKTURBO permission to the requestPermissions node in the module.json5 file of the entry module in your project.

"requestPermissions": [{
  "name": "ohos.permission.LINKTURBO"
}]