英文:
How to detect when user pastes something when application is running in the background?
问题
我正试图在我的应用程序在后台运行时检测用户是否在应用程序外粘贴了内容。具体来说,当他们按住并点击粘贴按钮时,我需要获取那个操作。
你们当中有没有人知道如何实现这个功能?
英文:
I am trying to detect when a user pastes something outside of my application while my app is running in the background. Specifically, when they hold down and hit the paste button I need to retrieve that action.
Do any of you know how to implement this functionality?
答案1
得分: 1
由于隐私和安全问题,这已不再可能。
来自谷歌:Android 10上的隐私变更:
对剪贴板数据的有限访问
除非您的应用是默认输入法编辑器(IME)或当前具有焦点的应用程序,否则您的应用在Android 10或更高版本上将无法访问剪贴板数据。
英文:
It's not possible anymore due to privacy and security concerns.
From Google: Privacy Changes on Android 10:
Limited access to clipboard data
Unless your app is the default input method editor (IME) or is the app that currently has focus, your app cannot access clipboard data on Android 10 or higher.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论