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"  
        ]  
      }  
    ]  
  }  
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.

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

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 无障碍扩展安装
1046浏览 • 1回复 待解决
HarmonyOS 无障碍扩展findElement
1087浏览 • 1回复 待解决
HarmonyOS 开启无障碍开关
1899浏览 • 1回复 待解决
HarmonyOS 如何在PaasSDK内部实现悬浮
720浏览 • 1回复 待解决
HarmonyOS 多模块下悬浮显示不出来
1202浏览 • 1回复 待解决
HarmonyOS 横向悬浮
745浏览 • 1回复 待解决
HarmonyOS 如何支持全局的悬浮
2185浏览 • 1回复 待解决
HarmonyOS 可拖动悬浮如何制作
661浏览 • 1回复 待解决
HarmonyOS 如何跨模块启动悬浮
816浏览 • 1回复 待解决
HarmonyOS 是否支持悬浮能力
861浏览 • 1回复 待解决
如何实现悬浮桌面穿透
1429浏览 • 1回复 待解决