HarmonyOS 鸿蒙Next如何在无障碍进程显示悬浮窗
HarmonyOS 鸿蒙Next如何在无障碍进程显示悬浮窗
在entry中展示悬浮窗正常,但在无障碍进程中调用时无反应,且控制台会打印:[nodict]<962>SetWindowType: set window type permission denied!
我在module.json5文件中是这样申请权限的:
{
“module”: {
“name”: “entry”,
“type”: “entry”,
“description”: “$string:module_desc”,
“mainElement”: “EntryAbility”,
“deviceTypes”: [
“phone”
],
“deliveryWithInstall”: true,
“installationFree”: false,
“pages”: “$profile:main_pages”,
“abilities”: [
{
“name”: “EntryAbility”,
“srcEntry”: “./ets/entryability/EntryAbility.ets”,
“description”: “$string:EntryAbility_desc”,
“icon”: “$media:layered_image”,
“label”: “$string:EntryAbility_label”,
“startWindowIcon”: “$media:startIcon”,
“startWindowBackground”: “$color:start_window_background”,
“exported”: true,
“skills”: [
{
“entities”: [
“entity.system.home”
],
“actions”: [
“action.system.home”
]
}
]
}
],
“requestPermissions”: [
{
“name”: “ohos.permission.SYSTEM_FLOAT_WINDOW”,
},
],
“extensionAbilities”: [
{
“name”: “AccessibilityExtAbility”,
“srcEntry”: “./ets/accessibilityextability/AccessibilityExtAbility.ets”,
“description”: “$string:AccessibilityExtAbility_desc”,
“label”: “$string:AccessibilityExtAbility_label”,
“type”: “accessibility”,
“metadata”: [
{
“name”: “ohos.accessibleability”,
“resource”: “$profile:accessibilityextability”
}
],
“permissions”: [
“ohos.permission.SYSTEM_FLOAT_WINDOW”
]
}
]
}
}
请问在无障碍进程中是否无法调用悬浮窗?
若是,请问在无障碍进程中能否调用实况窗?
我在module.json5文件中是这样申请权限的:
{
“module”: {
“name”: “entry”,
“type”: “entry”,
“description”: “$string:module_desc”,
“mainElement”: “EntryAbility”,
“deviceTypes”: [
“phone”
],
“deliveryWithInstall”: true,
“installationFree”: false,
“pages”: “$profile:main_pages”,
“abilities”: [
{
“name”: “EntryAbility”,
“srcEntry”: “./ets/entryability/EntryAbility.ets”,
“description”: “$string:EntryAbility_desc”,
“icon”: “$media:layered_image”,
“label”: “$string:EntryAbility_label”,
“startWindowIcon”: “$media:startIcon”,
“startWindowBackground”: “$color:start_window_background”,
“exported”: true,
“skills”: [
{
“entities”: [
“entity.system.home”
],
“actions”: [
“action.system.home”
]
}
]
}
],
“requestPermissions”: [
{
“name”: “ohos.permission.SYSTEM_FLOAT_WINDOW”,
},
],
“extensionAbilities”: [
{
“name”: “AccessibilityExtAbility”,
“srcEntry”: “./ets/accessibilityextability/AccessibilityExtAbility.ets”,
“description”: “$string:AccessibilityExtAbility_desc”,
“label”: “$string:AccessibilityExtAbility_label”,
“type”: “accessibility”,
“metadata”: [
{
“name”: “ohos.accessibleability”,
“resource”: “$profile:accessibilityextability”
}
],
“permissions”: [
“ohos.permission.SYSTEM_FLOAT_WINDOW”
]
}
]
}
}
请问在无障碍进程中是否无法调用悬浮窗?
若是,请问在无障碍进程中能否调用实况窗?
2 回复
创建WindowType.TYPE_FLOAT即悬浮窗类型的窗口,需要申请ohos.permission.SYSTEM_FLOAT_WINDOW权限,该权限为受控开放权限,仅2in1设备可申请该权限。
参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/application-window-stage-V5#开发步骤-3