Notification Permission for Opt-In Notifications

Notifications in Android 13 use an opt-in model, which is a change from previous Android versions, which use an opt-out model. In Android 13, all apps must ask users for permission before sending notification prompts. This model helps reduce notification interruptions, minimizes information overload, and helps users control what notifications appear based on what's important to them. To support the opt-in model, OEMs must implement changes in the notification and runtime permission systems.

This page describes what OEMs must implement to support this change and how to validate the implementation.

Implement changes for opt-in notifications

Starting with Android 13, apps must declare their intent to send notifications by requesting the android.permission.POST_NOTIFICATION runtime permission from the system before they can send notifications.

In Android 13 and higher, the setting that determines if an app can send notifications to the user is stored in the permission system. Prior to Android 13, this setting was stored in the notification system. Hence, OEMs must migrate the existing notification data about whether an app is allowed to send notifications, from the notification system into the runtime permission system. OEMs must also maintain existing APIs in the notification system that surface that data to app developers.

Changes to the notification and permission systems are based on the opt-in model of user notification behavior and are described in the Guidelines for implementation section.

Behavior of user notifications in an opt-in model

The following table illustrates the notification behavior for various app versions on a device running Android 13:

Device on Android 13 Apps targeting Android 13 or higher Apps targeting versions lower than Android 13
New install Notifications are blocked until prompted by the app.

Apps control when to ask for permission.

Notifications are blocked until prompted by the OS.

Permission is asked on the first run of the app.

Existing app (upgrade) Notifications are allowed until prompted by the app.

Temporary permission is granted until the app asks on the first qualifying run.

Notifications are allowed until prompted by the OS.

Temporary permission is granted until the first run of the app.

Guidelines for implementation

For reference implementation, refer to notification service, permission service and policy service. To implement exceptions for default permission handlers see Runtime Permissions.

During implementation, use the following guidelines on user notification behavior for apps targeting Android 13 or lower SDKs:

  • Freshly installed apps on an Android 13 device must not send a notification without the user approving a permission prompt.
    • If the app targets versions Android 13 and higher, notifications must be blocked until prompted by the app as the app controls when and if to ask for user permission.
    • If the app targets versions lower than Android 13, notifications must be blocked until prompted by the OS. The OS must show the permission prompt on the first run of the app.
  • Any app that existed on the device prior to an upgrade to Android 13, or any app that was restored through backup and restore, must be allowed to send notifications until the first time the user launches an activity from that app.

    • For apps that target SDK of versions Android 13 and higher, if the user hasn't previously customized notification settings for this app at the app or NotificationChannel level, revoke the temporary permission grant. Apps must then ask the user for permission before being allowed to continue to send notifications.

      If an upgraded app targeting Android 13 doesn't currently have the notification permission through the temporary upgrade grant, and the user has launched it at least once, the app must show a notification permission prompt before it’s allowed to run any further foreground services.

    • For apps that have a target SDK of versions lower than Android 13, intercept the first activity launch after the app has created at least one NotificationChannel to show a permission prompt asking if the user wants to receive notifications from the app.

      If a user previously customized notification settings at the app or NotificationChannel level for an app on the upgrading device or in a backup being restored to the device, the app level setting must be migrated into the permission system with the FLAG_PERMISSION_USER_SET flag. No further notification permission prompt must be shown to the user unless the app specifically asks it to be.

  • Backup and restore must be backward and forward compatible between an Android 13 device and a device from an earlier OS version. Backup data generated from an Android 13 device must restore onto an earlier OS version, and backup data from an earlier OS version must restore onto an Android 13 device.

  • Media notifications associated with ongoing media playback must be exempt from the notification permission.

Validate changes to the notification and permission systems

To validate the implementation, run the following tests: