Blog Infos
Author
Published
Topics
Author
Published

In this article, we will explore Android 13’s new clipboard UI, as well as privacy improvements 📋

Android 13 introduces a new UI for confirmation whenever data is added to the clipboard.

This new confirmation includes the following features
  • ✅ Confirms the content was successfully copied.
  • Provides a preview of the copied content.
Copy sensitive content to the clipboard
  • ClipData’s ClipDescription must be flagged if the app allows users to copy sensitive information to the clipboard.

A flag to pass to Clipdata’s clip description to flag sensitive content:

ClipDescription.EXTRA_IS_SENSITIVE
Sensitive content implementation
val clipboardManager = context.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
// When setting the clip board text.
val clipData = ClipData.newPlainText(/* label = */ "Sample copy data",/* text = */ context.getString(R.string.clip_preview))
.apply {
description.extras = PersistableBundle().apply {
// only available for Android13 or higher
putBoolean(ClipDescription.EXTRA_IS_SENSITIVE, true)
// use raw string for older versions
// android.content.extra.IS_SENSITIVE
}
}
clipboardManager.setPrimaryClip(clipData)

ClipboardSensitiveContent.kt

 

Demo 📋
  • Non-Sensitive content

 

Non-sensitive content

 

  • Sensitive content

 

Sensitive content

 

Job Offers

Job Offers


    Sr. Software Development Engineer, Last Mile Driver Assistance Technology

    Amazon
    Berlin
    • Full Time
    apply now

    Kotlin Multiplatform Mobile Developer

    Touchlab
    Remote
    • Full Time
    apply now

OUR VIDEO RECOMMENDATION

,

Luis Tsai & Ayushi Gupta

Listen to droidcon Berlin 2022 conversations with Madonna & Matt up next Luis Tsai & Ayushi Gupta.
Watch Video

Droid-Conversations

with Madona & Matt

Luis Tsai & Ayushi Gupta

Droid-Conversations

with Madona & Matt

Luis Tsai & Ayushi Gupta

Droid-Conversations

with Madona & Matt

Luis Tsai & Ayushi Gupta

Jobs

😊😊 👏👏👏👏 HAPPY CODING 👏👏👏👏 😊😊

 

 

This article was originally published on proandroiddev.com on August 08, 2022

YOU MAY BE INTERESTED IN

YOU MAY BE INTERESTED IN

blog
Today, We will explore the New notification 🔔 runtime permission that was added in…
READ MORE
blog
Android 13 (API 33) introduces a new tool called photo picker 🖼. Today, we…
READ MORE
blog
How to use the new feature from Android 13 to display your app in…
READ MORE
blog
Since the introduction of Android 12 (SDK 31) last Fall, some Android devices have…
READ MORE

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.

Menu