开发者

How to observe Android's Clipboard, really?

开发者 https://www.devze.com 2023-01-02 14:00 出处:网络
I need to detect Android Clipboard\'s content changes, and register the changes, but I can\'t really understand how to ac开发者_运维知识库hieve such result.

I need to detect Android Clipboard's content changes, and register the changes, but I can't really understand how to ac开发者_运维知识库hieve such result.

There are a lot of clipboard managers around, but I found none open source, and it's difficult to believe they work by checking the clipboard every 15 seconds.

Is there a good method to observe clipboard changes ?

Thanks in advance !


Since API version 11 ("Android 3.0"), there is a new service and appropriate callback ClipboardManager.OnPrimaryClipChangedListener


According to this thread, at least for the Clipper program, they do indeed poll the clipboard - every 5 seconds. There doesn't seem to be anything in the API to do it any other way.

0

精彩评论

暂无评论...
验证码 换一张
取 消