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


    Senior Android Engineer

    Carly Solutions GmbH
    Munich
    • Full Time
    apply now

    Senior Android Developer

    SumUp
    Berlin
    • Full Time
    apply now

OUR VIDEO RECOMMENDATION

,

Bringing Android 13 to Tesla vehicles with Flutter Web

Did you know that you can use your favorite Android apps while driving your Tesla? Join me in this session to learn how the Tesla Android Project made it all possible with Flutter Web on…
Watch Video

Bringing Android 13 to Tesla vehicles with Flutter Web

Michał Gapiński
Senior Software Engineer
HappyByte

Bringing Android 13 to Tesla vehicles with Flutter Web

Michał Gapiński
Senior Software Engi ...
HappyByte

Bringing Android 13 to Tesla vehicles with Flutter Web

Michał Gapińsk ...
Senior Software Engineer
HappyByte

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
While Targeting Android 13 , OnbackPressed Override Function is deprecated😢. Usually, we used to…
READ MORE
blog
Today, We will explore the New notification 🔔 runtime permission that was added in…
READ MORE
blog
App launcher icons, the very first interaction that someone has with your app is…
READ MORE
blog
As we know, with every release, Android deprecates some APIs and introduces new ones…
READ MORE

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Menu