I'm a solo developer. Over the last year I've published a few dozen small Android utilities under the name DangNH Studio, and one of them is a clipboard manager called ClipFox. I assumed it would be the easy one. A clipboard is one system service, how hard can it be?
It turned out to be the app where Android's privacy changes affected my design the most. Here is what I learned, in the order it surprised me.
1. The background listener stopped working
The classic clipboard manager idea is this: register a listener, record every copy, show the history later.
val cm = getSystemService ( ClipboardManager :: class . java ) cm . addPrimaryClipChangedListener { val text = cm . primaryClip ? . getItemAt ( 0 ) ? . coerceToText ( this ) saveToHistory ( text ) }
Enter fullscreen mode
Exit fullscreen mode
On Android 9 and below this worked from a background service.…