0

I'd like to develop an application that does some processing on text copied on clipboard.

I want to prevent user from copying the text, switching to my application, pasting the text and clicking on process. The process would be done instantly as the user simply copies text on clipboard. He would then go on the application to see the process done on the text copies he's made.

Is there a way to have a kind of listener on text copies on clipboard ?

Thanks

  • `copying the text, switching to my application` - this suggests you want to be able to listen to text the user copied inside other applications. if you ever find a way of doing this, you'll have more chances to make money by reporting such a serious privacy and security breach to Google and collecting a bounty. – Franci Penov Apr 27 '12 at 04:23
  • Hi, did you solve this problem ? – henry4343 Jul 21 '14 at 01:53

3 Answers3

1

1.Use ClipboardManager.OnPrimaryClipChangedListener for triggering callback when text is copied in any app.

2.Launch your App when text copy event is triggered

3.Use ClipboardManager.getPrimaryClip () to get the copied text in your app. Use the text as you want it.

And you're done.

100rabh
  • 6,156
  • 5
  • 27
  • 41
0

The way you mention sounds too intrusive. An alternate way is to parse each "keystroke" as it comes into your app. If it comes in too fast, then don't accept it on the theory that it was pasted in.

MarkHu
  • 1,694
  • 16
  • 29
0

Override the long press event on the edittext field. Check out this post on how to do it.

Community
  • 1
  • 1
hook38
  • 3,899
  • 4
  • 32
  • 52