HarmonyOS 如何在无障碍进程显示悬浮窗?

在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"  
        ]  
      }  
    ]  
  }  
}

请问在无障碍进程中是否无法调用悬浮窗?若是,请问在无障碍进程中能否调用实况窗?

HarmonyOS
2024-10-08 10:04:47
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
superinsect

创建WindowType.TYPE_FLOAT即悬浮窗类型的窗口,需要申请ohos.permission.SYSTEM_FLOAT_WINDOW权限,该权限为受控开放权限,仅2in1设备可申请该权限。参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/application-window-stage-V5#开发步骤-3

分享
微博
QQ
微信
回复
2024-10-08 15:54:04
相关问题
HarmonyOS 无障碍扩展安装
354浏览 • 1回复 待解决
HarmonyOS 无障碍扩展findElement
390浏览 • 1回复 待解决
HarmonyOS 多模块下悬浮显示不出来
378浏览 • 1回复 待解决
HarmonyOS 悬浮的圆角怎么处理?
69浏览 • 1回复 待解决
如何实现悬浮桌面穿透
827浏览 • 1回复 待解决
HarmonyOS有没有悬浮组件或者库
424浏览 • 1回复 待解决
HarmonyOS 悬浮拖拽功能怎么处理?
339浏览 • 1回复 待解决