怎样查网站和增加网站,为什么自己做的网站别人打不开,wordpress定制企业站,天河岗顶棠下上社网站建设1.问题描述#xff1a;
文档哪里能找到所有的权限查看该权限是用户级的还是系统级的。
解决方案#xff1a;
您好#xff0c;可以看一下下方链接是否可以解决问题#xff1a;
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/permissions-for-all-V…1.问题描述
文档哪里能找到所有的权限查看该权限是用户级的还是系统级的。
解决方案
您好可以看一下下方链接是否可以解决问题
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/permissions-for-all-V5
https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/permissions-in-acl-V5
2.问题描述
查阅文档发现isApplicationEnabled方法已被弃用目前如何判断手机中某个应用是否已安装
解决方案
应用是否已安装
目前判断应用是否在手机安装在API 12之前并不支持。
在API 12之后bundleManager支持canOpenLink接口通过配置module.json5的querySchemes属性在代码中可以通过一下代码确定对应应用是否安装
参考链接https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-bundlemanager-V5#ZH-CN_TOPIC_0000001893370881__bundlemanagercanopenlink12
3.问题描述
如何在代码中获取oh-package.json5中的信息比如版本version或者描述description?
解决方案
可以通过hvigor脚本实现。
hvigor自定义任务指导https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V2/custom-hvigor-0000001650987753-V2
hvigor命令行指导https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V2/ide-command-line-hvigor-0000001553317645-V2
Demo 这里展示在har module的hvigorfile.ts文件下编写脚本代码实现 1.获取并解析oh-package.json5中的内容 2.获取har产物的路径 3.修改har产物的名称 import { harTasks } from ohos/hvigor-ohos-plugin;import fs from fsinterface OhPackage {name: string;version: number;description: string;author: string;}export function renameHarTask(str?: string) {return {pluginId: RenameHarTaskID,apply(pluginContext) {pluginContext.registerTask({// 编写自定义任务name: renameHarTask,run: (taskContext) gt; {//读取oh-package.json5解析出versionconst packageFile taskContext.modulePath\oh-package.json5;console.log(file: , packageFile);let fileContent fs.readFileSync(packageFile, utf8);console.log(fileContent);const content: OhPackage JSON.parse(fileContent);const version content.version;const author content.author;console.log(renameHarTask: , taskContext.moduleName, taskContext.modulePath);const sourceFile taskContext.modulePath \\build\\default\\outputs\\default\\ taskContext.moduleName .har;const targetFile taskContext.modulePath \\build\\default\\outputs\\default\\ taskContext.moduleName - version - author .har;console.log(renameHarTask: sourceFile: , sourceFile);console.log(renameHarTask: targetFile: , targetFile);// 修改产物名fs.rename(sourceFile, targetFile, (err)gt; {console.log(err: err);});},// 确认自定义任务插入位置dependencies: [defaultPackageHar],postDependencies: [assembleHar]})}}}export default {system: harTasks,plugins:[renameHarTask()]}实现效果 在Terminal窗口执行 ./hvigorw renameHarTask 查看build/default/outputs/default/下的har,可以看到生成的har已经修改为了我们代码中指定的taskContext.moduleName ‘-’ version ‘-’ author ‘.har’
4.问题描述
编译报错The default system capabilities of devices phone, tablet, 2in1 do not include SystemCapability.Communication.NFC.Tag. Configure the capabilities in syscap.json.
解决方案
报错提示是不包括SystemCapability.Communication.NFC.Tag需要syscap.json中配置。
可参考链接https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/syscap-V5#ZH-CN_TOPIC_0000001904100062__pcid%E5%AF%BC%E5%85%A5