This topic describes how to add the miniapp component to a HarmonyOS NEXT client. You can add the miniapp SDK to an existing project using the .ohpmrc file.
Prerequisites
Before adding the miniapp SDK, ensure that your project is integrated with mPaaS. For more information, see Integrate with mPaaS.
Import dependencies
You can add the following repository to the .ohpmrc file in your project.
@mpaas:registry=https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/meta
Add the SDK
You can install the miniapp component using the mppm tool.
Configure permissions
You can configure the required permissions in the module.json5 file.
"requestPermissions":[
{
"name" : "ohos.permission.GET_NETWORK_INFO",
},
{
"name" : "ohos.permission.INTERNET",
},
{ // Add this permission if the code scanning feature is used.
"name": "ohos.permission.CAMERA",
"reason": "$string:internet_reason",
"usedScene": {}
},
{ // Add this permission if the location feature is used.
"name": "ohos.permission.LOCATION",
"reason": "$string:internet_reason",
"usedScene": {
}
},
{
"name": "ohos.permission.LOCATION_IN_BACKGROUND",
"reason": "$string:internet_reason",
"usedScene": {
}
},
{ // Add this permission for clipboard access.
"name": "ohos.permission.READ_PASTEBOARD",
"reason": "$string:internet_reason",
"usedScene": {
}
},
{// Add this permission if the save image API is used.
"name": "ohos.permission.WRITE_IMAGEVIDEO",
"reason": "$string:internet_reason",
"usedScene": {
}
},
]
该文章对您有帮助吗?