DEV Community

CodeDAC
CodeDAC

Posted on

Android 10's clipboard restriction and serverless phone-to-PC sync: building Clipboard+

I'm a solo developer making small utility apps for Android and Windows. The one with the most users is Clipboard+, a clipboard history manager. Two problems shaped almost every design decision in it: Android 10's clipboard restriction and syncing between phone and PC without running a server. Here's how I handled both.

1. Since Android 10, background apps can't read the clipboard

From Android 10 (API 29), only the app that currently has input focus (or the default keyboard) can read the clipboard. The classic clipboard-manager design, a background service that saves every copy, simply stops working. There are workarounds through accessibility services or log permissions, but given Play policy and user trust I didn't want to go there.

So I changed the promise instead of fighting the platform:

  • No "auto-save" claim. I removed that wording from the store listing too.
  • Save every time the app legitimately gets focus: when the app opens, when you tap the floating panel, and when you use the home-screen widget. The floating panel is an overlay window that is normally FLAG_NOT_FOCUSABLE; on tap it briefly clears that flag to take focus, reads the clipboard, then gives focus back.
  • For saving without switching apps, there's an entry in the text selection menu (ACTION_PROCESS_TEXT). Select text anywhere, pick "Clipboard+", and it lands in the history.

You lose "everything you copy just piles up", but "the moment you open the panel to paste, the last thing you copied is saved too" covers most real use.

2. No sync server

Clipboards are full of passwords, addresses, account numbers and one-time codes. I didn't want any of that passing through my server, and as a one-person studio I didn't want to run one forever either.

So the storage is the user's own Google Drive:

  • The Android and Windows apps each connect to the user's Drive and sync through the hidden, app-only appDataFolder. It doesn't show up in the Drive UI, and the app can't see the user's other files. Sync uses the drive.appdata scope; backup files use drive.file, which only covers files the app created.
  • On Android I skipped the old Drive Android API: AuthorizationClient just gets an access token, and the app calls Drive REST v3 directly. Fewer dependencies, and the same API shape as the Windows side.
  • No server means no hosting cost, and I can honestly tell users "your data only lives in your own Drive".

3. Don't hold data hostage when people switch phones

Backup and restore started as paid features. Keeping someone's data locked when they change phones felt wrong, so backup file export/import and Drive restore are now free. Pro is ad removal, live phone-PC sync, unlimited image clips and the larger panel/widget.

Feedback welcome

  • Cases where something doesn't get saved (which app, which Android version)
  • Whether the "your own Drive, no server" setup feels trustworthy, or whether the permission screen makes it feel the opposite

I read every comment.

Top comments (0)