Android 13 Push Notification Developer Update Guide

This guide ensures your app is ready for Android 13’s new Notification Permission requirements.

Android Push Subscription Changes

The release of Android 13 comes with many push subscription changes. Users will now be asked to opt-in to receive push notifications, instead of opting in by default and having to opt-out. With the following guidance, OneSignal will enable you to prompt Android mobile app users to subscribe to push the right way.

To prepare and update your app for Android 13 permission prompt process, you will need to:

  • Update to the latest version of the OneSignal SDK for your platform (v 4.8.1+)
  • Add notification permission prompting to support any new installs on Android 13+

If no action is taken, Android 13 users who install your app will be immediately prompted for notification permission the first time they open your app. This isn’t the best user experience so this developer guide walks you through the changes you need to make to prompt later, at a more ideal time.

Push Permission Behaviors

Android 13 requires prompting users for permission to show push notifications. This change applies to ALL newly installed apps on Android 13. Generally, there are 3 states for push permissions: Allow, Don’t Allow, and Ignored. Here’s how it will work:

Allow

  • If a user has already granted permission on an older Android OS (12-), they will not be prompted again.
  • If a user installs the app on an Android 13 device, notifications are in the “don’t allow” state by default. The user must grant permission before any notifications will be sent to them. This is a case where sending an in-app message with a push permission prompt can promote push subscriptions.
  • If your app targets Android 13, you can control when the push permission prompt is sent. This is why it is important to ensure your app is updated. If you can time the prompt and use an in-app message to explain the value, users will more likely accept the prompt.
  • If your app targets Android 12 or lower, the push permission prompt will likely show when the user updates to Android 13 and opens the app.

Don’t Allow

  • If you have updated your app to Android 13 and the user selects “don’t allow”, then your app cannot send them push notifications.
  • If you have not updated your app to Android 13, and the user has selected “don’t allow” previously, they will not be asked for push permission again until either the user uninstalls and reinstalls your app, or your app is updated to target Android 13.

Ignored

  • If the user swipes the dialog away, choosing neither to “allow” or “don’t allow”, the notification permission state does not change.

Push Permission Prompts through an In-App Message

In order to obtain user push notification permissions, you can use in-app messaging to trigger a prompt. This is done by adding a Push Permission Prompt Click Action to your in-app message.

In-App Messages with a Push Permission Prompt button will not be shown to users who have already allowed notifications. If users have previously denied push permission when shown the native prompt, this button will open the device settings for your app.

Creating a push permission prompt in-app message is simple. You can add a click action through the block editor by clicking the “Click Action” dropdown, and selecting “Push Permission Prompt”. You can also add it through the HTML editor.

For tips on how to maximize opt in rates, refer to our Android 13 Updates Blog Post and guide on How to Prompt for Push Permissions with an In-App Message.

Updating Your App for Android 13

Step 1. Update Your OneSignal SDK

Android Native: OneSignal-Android-SDK 4.8.0 +

Unity: OneSignal Unity SDK 3.0.3 +
Flutter: OneSignal Flutter version 3.4.0 +
React Native: OneSignal React Native version 4.4.0 +
Cordova / Ionic: OneSignal Cordova version 3.1.0 +
Xamarin: OneSignalSDK.Xamarin 4.1.3 +

Step 2. Update project settings to target Android 13

Validate that your app is configured to target Android API level 33 or newer, and follow one of the sections below for the type of project you have.

Android Native
Validate your compile and target SDK version is at least version 33

android {
    compileSdkVersion "33"

    defaultConfig {
        targetSdkVersion "33"
    }
}

See Google’s Set up the Android 13 SDK for more details if you have a different project configuration.

Unity
Use Unity 2021.3.0f1 or newer.

Add Android 13 as a custom dependency to the Unity Editor’s Android SDK Tools.
See Unity’s Customizing dependencies guide.

Set the Target API Level to API level 33 in the Android Player Settings.
See Unity’s Setting the Android SDK Target API guide.

Flutter
Validate your compile and target SDK version is at least version 33.

android {
    compileSdkVersion 33

    defaultConfig {
        targetSdkVersion 33
    }
}

React Native
Validate your compile and target SDK version is at least version 33.

android {
    compileSdkVersion 33
    ...

    defaultConfig {
        ...
        targetSdkVersion 33
    }
}

Cordova / Ionic
Requirements:

  • Ionic Capacitor v2 or higher
  • Or Cordova Android Platform 9.1.0 or higher

Validate your target SDK version is at least version 33.

android {
    compileSdkVersion 33
    ...

    defaultConfig {
        ...
        targetSdkVersion 33
    }
}
1103

Set the Compile Sdk Version to 33

1103

In Default Config, set the Target SDK Version to 33.

Xamarin
Ensure you are using Visual Studio 2019 or newer. Open your Android project’s options, then under Build > Android Application set your “Target Android version” to “Android 13.0 (API level 33)”.

1386

Set your “Target Android version” to “Android 13.0 (API level 33)”.

Step 3. Add Notification Permission Prompt

Trigger the notification permission prompt via one or both of these options in your app.

These same OneSignal options already existed for iOS, so you may only need to rebuild your app and test on Android 13 to validate everything.

Option 1. In-App Message Prompt

Follow the OneSignal’s guide on How to Prompt for Push Permissions with an In-App Message for details on how to prompt via an In-App message to explain to your users why they should enable notifications.

Option 2. Programmatically Trigger the Native Permission Prompt

Not Recommended: use the below OneSignal method to trigger the native Permission Prompt. It is recommended to use the above or your own soft-prompt first before triggering this method.

Show the Android native notification permission prompt from your own UI or logic.

OneSignal.promptForPushNotifications()
OneSignal.promptForPushNotifications();
window.plugins.OneSignal.promptForPushNotificationsWithUserResponse()
OneSignal.promptForPushNotificationsWithUserResponse();
OneSignal.shared.promptUserForPushNotificationPermission();
OneSignal.Default.PromptForPushNotificationsWithUserResponse();