Oleh Romanenko
Oleh Romanenko

Reputation: 299

How to hide sensitive data when using Android clipboard?

In Android API 33, when you copy something to clipboard, a special bar appears:

The clipboard bar

If the copied data is sensitive, you can set ClipDescription.EXTRA_IS_SENSITIVE to true for the clip:

        PersistableBundle persistableBundle = new PersistableBundle();
        persistableBundle.putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true);
        clip.getDescription().setExtras(persistableBundle);

As a result, the copied data becomes hidden:

Hidden text in the clipboard bar

However, when you click the share button on that bar or use the copied text in another app, the text is revealed:

Sharing copied text using the clipboard bar

Or

Sensible data is visible on the top of the soft keyboard

The question is how to hide sensitive data in this scenario?

Upvotes: 0

Views: 623

Answers (0)

Related Questions