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 Software Engineer (f/m/d)

    Paradox Cat GmbH
    Munich
    • Full Time
    apply now

    Android Software Engineer (f/m/d)

    Paradox Cat GmbH
    Munich
    • Full Time
    apply now

    Android Test Automation Engineer

    Komoot
    Remote
    • Full Time
    apply now

OUR VIDEO RECOMMENDATION

, ,

From Scoped Storage to Photo Picker: Everything to know about Storage

Persistence is a core element of every mobile app. Android provides different APIs to access or expose files with different tradeoffs.
Watch Video

From Scoped Storage to Photo Picker: Everything to know about Storage

Yacine Rezgui
Android developer advocate
Google

From Scoped Storage to Photo Picker: Everything to know about Storage

Yacine Rezgui
Android developer ad ...
Google

From Scoped Storage to Photo Picker: Everything to know about Storage

Yacine Rezgui
Android developer advocat ...
Google

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
Android 13 (API 33) introduces a new tool called photo picker 🖼. Today, we…
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