Closed MexHigh closed 1 year ago
Android has clipboard permissions which are not declared by the app, but even after adding those I get the following error in the console using this demo page:
Uncaught TypeError: Cannot read properties of undefined (reading 'query')
when executing navigator.permissions.query({name: "clipboard-write"})
Uncaught TypeError: Cannot read properties of undefined (reading 'request')
when executing navigator.permissions.request({name: "clipboard-write"})
Uncaught TypeError: Cannot read properties of undefined (reading 'writeText')
when executing navigator.clipboard.writeText("test")
initially, Uncaught (in promise) DOMException: Write permission denied.
after adding the Android permissionSearching online I can find others encountering this issue and resorting to custom JS interfaces, suggesting that clipboard access simply is not supported by webview.
Have you tried debugging this yourself using Chrome remote devtools? What did you find?
Found a Chromium issue confirming this is a bug/missing feature in WebView, closing as this can't be solved by the app https://bugs.chromium.org/p/chromium/issues/detail?id=1271620&q=webview%20clipboard&can=2
Hmm, that's sad.
Have you tried debugging this yourself using Chrome remote devtools? What did you find?
Nope. I'm not familiar with Android (and Webview) at all. So thanks for looking that up.
Home Assistant Android app version(s): 2023.7.5-full
Android version(s): 11
Device model(s): ONEPLUS A6003 ("OnePlus 6")
Home Assistant version: 2023.08.1
Last working Home Assistant release (if known): -
Description of problem, include YAML if issue is related to notifications:
I'm currently developing a Home Assistant Add-on that can copy some text to the users' clipboard using the JavaScript function
navigator.clipboard.writeText()
inside its ingress dashboard (leaving the exact details on how the Add-on works out, as they are irrelevant, see below for details). Copying to the clipboard works in all scenarios but ingress inside the companion app (even when browsing the add-on via Home Assistant ingress in a mobile browser).I think this might be a permission problem of the app (writing to the clipboard is prohibited?). Is this intended and are there alternatives?
Companion App Logs:
Screenshot or video of problem: Not required, nothing to see
Additional information:
If you want to take a look at the source code of the extension, you can view it here: https://git.leon.wtf/leon/one-time-service.
The relevant code lines (fixed on current commit) are: