0Pricing
Android Academy · Lesson

The Notification Runtime Permission

Request notification permission on Android 13+.

The Notification Runtime Permission is a free Android Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Android Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

The Notification Permission

Starting with Android 13 (API 33), apps must request a runtime permission to post notifications: POST_NOTIFICATIONS. Without it, your notifications are silently blocked.

Why It Was Added

Before Android 13, notifications were on by default and users had to dig into Settings to mute noisy apps. The runtime permission flips this: users now explicitly opt in, reducing spam.

Declare It in the Manifest

First declare the permission in AndroidManifest.xml. This is required on every supported version even though the prompt only appears on API 33+.

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

It Is a Dangerous Permission

POST_NOTIFICATIONS is classified as a runtime (dangerous) permission, so on Android 13+ you must request it from the user and handle their answer, just like camera or location.

Behavior by Version

Version differences matter:

  • API 33+: must request at runtime; denied means no notifications
  • API 32 and below: notifications are allowed by default; no prompt needed

Check Before Requesting

Only request on Android 13 and above, and only if not already granted. Guard the call with a version check.

val needsRequest = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
    ContextCompat.checkSelfPermission(
        context, Manifest.permission.POST_NOTIFICATIONS
    ) != PackageManager.PERMISSION_GRANTED

Requesting in Compose

Use the same Activity Result API you learned for other permissions: a launcher with the RequestPermission contract, launched with POST_NOTIFICATIONS.

val launcher = rememberLauncherForActivityResult(
    ActivityResultContracts.RequestPermission()
) { granted ->
    // update UI based on whether notifications are allowed
}

Launching the Request

Trigger the request only on API 33+, ideally when the user does something that benefits from notifications, not blindly at launch.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
    launcher.launch(Manifest.permission.POST_NOTIFICATIONS)
}

Ask in Context

As with all permissions, request in context. For example, ask after the user enables a feature like reminders, explaining the benefit, rather than the moment the app opens.

Handle Denial Gracefully

If denied, do not break. Disable notification-dependent toggles or show a hint that notifications are off, with a link to system Settings if the user wants to enable them later.

Target SDK Triggers Enforcement

The runtime requirement applies when your app targets API 33+. If an older app runs on Android 13, the system may show the prompt automatically on first post, but you should still request explicitly.

Quick Check

Test your understanding of the notification runtime permission.

Recap

You handled the notification permission:

  • Android 13+ requires the POST_NOTIFICATIONS runtime permission
  • Declare it in the manifest and request it with the Activity Result API
  • Guard requests with a version check and ask in context
  • Degrade gracefully when denied

You have finished the Notifications course.

Frequently asked questions

Is the “The Notification Runtime Permission” lesson free?

Yes — the full text of “The Notification Runtime Permission” is free to read here on the web, and the Android Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Android Academy course, upgrade to CoddyKit PRO.

What will I learn in “The Notification Runtime Permission”?

Request notification permission on Android 13+. You practise Android Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Android Academy?

No prior experience is required. Android Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “The Notification Runtime Permission” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Android Academy lesson?

Yes. Every Android Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Notification Channels
  2. Building a Notification
  3. Actions and Deep Links
  4. The Notification Runtime Permission
← Back to Android Academy