Add the SDK

更新时间:
复制 MD 格式

This topic describes how to integrate the Mobile Push component into a HarmonyOS NEXT client. You can add the Push SDK to an existing project using the ohpmrc method.

Prerequisites

Before adding the Mobile Push SDK, ensure that your project is integrated with mPaaS. For more information, see Integrate mPaaS capabilities.

Add the SDK

Configure the required dependencies in the oh-package.json5 file:

{
  "license": "",
  "devDependencies": {},
  "author": "",
  "name": "entry",
  "description": "Please describe the basic information.",
  "main": "",
  "version": "1.0.0",
  "dependencies": {
    "@mpaas/push": "0.0.2"
  }
}

Configure permissions

The app requires the following three permissions.

{
 "name" : "ohos.permission.GET_NETWORK_INFO",
},
{
 "name" : "ohos.permission.SET_NETWORK_INFO",
},
{
 "name" : "ohos.permission.INTERNET",
}