luc
luc

Reputation: 199

Broadcast receiver for clipboard activity

Even when the application is not running, I want to grab the content whenever something is copied.

For example, if the user copies something then, the application will receive a broadcast and start a service (calling an API, in my case). ALL IN THE BACKGROUND. I tried setting a broadcast receiver for USER_PRESENT and managing the clipboard from there, but in vain.

Upvotes: 2

Views: 177

Answers (1)

Ryan M
Ryan M

Reputation: 20157

As of Android 10, this is not possible unless your app currently has input focus (that is, not in the background) or is the user's currently selected keyboard app.

Because this is a privacy feature, there is, for better or worse, no way around it other than integrating the feature you want to build into a keyboard app.

Upvotes: 1

Related Questions