如何在应用程序在后台运行时检测用户何时粘贴了内容?

huangapple go评论71阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年10月9日 00:16:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/64266614.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定