ReCap: Android 11 People & Identity

The Android Developer site is providing cool learning pathways with their new ‘11 Weeks of Android‘. I’m going to recap each one here because Android development is one of my favorite topics.


Android 11 includes the Connection Notification API with their Google Identity Services Library for a better user signup / signin process.

The Android 11 OS recognizes and prioritizes the most important people in our lives with conversation notifications that show up at the top of the device screen with options that affect notification ranking and prioritization:

  • open conversation in a bubble
  • create conversation shortcut on home screen
  • set a reminder


Notifications signal the UI to send short info about events in your app to the user: news alert, chat message, event reminder. They appear when your app is not in use. A few notification types include:

  • Bubble Notifications
  • People Notifications
  • Messaging Style Notifications
  • Heads-up Notifications

Add Support Library:

Use NotificationCompat APIs from the Android support library to add notification features for new devices while still being compatible for older devices to Android 4.0 (API level 14). Note, inline reply will not work on older devices. Add the following code to our build.gradle file:

dependencies {    
implementation ""

Create Basic Notification

Basic compact notification includes an icon, title and brief text.

Set Notification Content

var builder = NotificationCompat.Builder(this, CHANNEL_ID)

Android 8.0 (API Level 26) and higher requires the Channel ID while the older Android versions ignore it.

Enable Expandable Notification

var builder = NotificationCompat.Builder(this, CHANNEL_ID)
        .setContentTitle("My notification")
        .setContentText("Much longer text that cannot fit one line...")
                .bigText("Much longer text that cannot fit one line..."))


Create Channel & Set Importance

Execute the following code as soon as your app starts because you must create the notification channel before posting notifications on Android 8.0 and higher. No operation is performed when creating a notification, so it is safe to call this repeatedly.

private fun createNotificationChannel() {
    // Create the NotificationChannel, but only on API 26+ because
    // the NotificationChannel class is new and not in the support library
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        val name = getString(R.string.channel_name)
        val descriptionText = getString(R.string.channel_description)
        val importance = NotificationManager.IMPORTANCE_DEFAULT
        val channel = NotificationChannel(CHANNEL_ID, name, importance).apply {
            description = descriptionText
        // Register the channel with the system
        val notificationManager: NotificationManager =
            getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

Set Notification Tap Action

// Create an explicit intent for an Activity in your app
val intent = Intent(this, {

val pendingIntent: PendingIntent = PendingIntent.getActivity(this, 0, intent, 0)

val builder = NotificationCompat.Builder(this, CHANNEL_ID)
        .setContentTitle("My notification")
        .setContentText("Hello World!")
        // Set the intent that will fire when the user taps the notification

Show the Notification

Use the notification ID we passed in NotifcationManagerCompat.notify() – you will need it later if you want to update or remove the notification.

with(NotificationManagerCompat.from(this)) {
    // notificationId is a unique int for each notification that you must define

Messaging Style Notifications

Messaging style notifications have a dedicated section in the drawer / shade area of the device screen and make it easier to share & allow actions with the person you are messaging.

One Tap & Google Identity Services

Reduce drop-off friction and improve user conversion rates with One API to bring the features of Google Sign-In and Smart Lock for Passwords into your Android apps. One Tap supports:

  • Sign in to existing account with your Android app service using their Google account or Google saved passwords.
  • Sign up for new account with your Android app service using their Google account (federated login)

Add the following to your dependencies: with minimum version 18.0.0

Google Identity Services is a suite of libraries that will eventually include the full feature set of the Smart Lock for Passwords, Google Sign-In libraries and other new features.

One Tap is the 1st Google Identity Service feature that is ready to use for optimizing sign in & sign up flows. It can overlay any Activity in your Android application.

This concludes my notes for Android 11, People & Identity. Check out the resources for code repositories and more details.