Push notification permission prompt not appearing on Android 14

Hey everyone, I’m scratching my head over this one. I updated our app to work with Android 14, but now push notifications are blocked by default. I know Android changed to an opt-in model for notifications, but I can’t get the permission dialog to show up.

Here’s the weird part: my code works fine for asking about camera permission, but it’s silent for notifications. I’ve set up the runtime permission request like the docs say, but no dice. Here’s a simplified version of what I’m doing:

fun askForPermission() {
    when {
        checkPermissionGranted(NOTIFY_PERMISSION) -> {
            // We're good to go
        }
        shouldExplainPermission(NOTIFY_PERMISSION) -> {
            // Show rationale then ask
            permissionLauncher.launch(NOTIFY_PERMISSION)
        }
        else -> {
            // Just ask
            permissionLauncher.launch(NOTIFY_PERMISSION)
        }
    }
}

This works great for the camera, but not for notifications. I’ve double-checked the manifest, and the permissions are there. Anyone run into this or know what I’m missing? It’s driving me nuts!

I encountered a similar situation with Android 14. The key point is that notification permissions are handled differently compared to other runtime permissions. Before anything, ensure that your targetSdkVersion is set to 33 or higher in your build file because the new permission model depends on it. Also, include the POST_NOTIFICATIONS permission in your manifest so that the system is aware of your app’s request. You can then check whether notifications are enabled using the NotificationManager and, if necessary, launch the permission request. This approach should prompt the notification dialog.

hey there, i ran into this too! turns out android 14 has a new thing called ‘notification runtime permission’. you gotta use the POST_NOTIFICATIONS permission now. try adding this to ur manifest:

that should make the prompt show up. lmk if it helps!

I’ve encountered this issue as well. It’s not just about adding the permission to the manifest. Android 14 introduces a new concept called ‘notification permission flags’. You need to set these flags in your app’s manifest to indicate which notification types your app will use.

Here’s what worked for me:

  1. Add the POST_NOTIFICATIONS permission to your manifest.
  2. Set notification permission flags in your manifest’s application tag.

For example:

<application

android:notificationPermissionFlags=“instant_messages|reminders”>

This tells the system what kinds of notifications you’ll be sending, which can affect how the permission request is handled. Make sure you’re only requesting flags for notification types you actually use.

Also, double-check that you’re targeting SDK 33 or higher in your build.gradle file. The new permission model won’t kick in otherwise.

Hope this helps solve your notification woes!