> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pushbase.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Request permission

> Ask for user consent to receive push notifications

<img src="https://mintcdn.com/pushbase/nkMYcoi9amrb3572/images/request-notification-permission.png?fit=max&auto=format&n=nkMYcoi9amrb3572&q=85&s=031c312e896d7d0c6e9a56962cd645b6" alt="Request push permission" width="1920" height="1080" data-path="images/request-notification-permission.png" />

<p>
  To send push notifications that appear in the notification center, play
  sounds, or trigger other behaviors, your app must first obtain the user’s
  permission. Both iOS and Android require explicit user consent before allowing
  notifications, but there are key differences between platforms:
</p>

**iOS:**

Notification permission must be requested at runtime using the system prompt. The user’s response (granted or denied) is final unless they manually change it in system settings. Notifications will not be delivered unless permission is explicitly granted.

**Android (Android 13+ / API 33+):**

Starting with Android 13, notification permission must also be requested at runtime, similar to iOS. For older versions, permission is granted by default upon app install, though users can still manually disable notifications in system settings.

Google and Apple recommend that developers clearly communicate the purpose of a permission request to users **before** prompting them for access. Providing context helps build trust and improves the likelihood that users will grant the requested permission

<img src="https://mintcdn.com/pushbase/nkMYcoi9amrb3572/images/request-permission-flow.png?fit=max&auto=format&n=nkMYcoi9amrb3572&q=85&s=f1a9e222e052d2187e1804652349a160" alt="Request push permission" title="Follow  best practices when requesting notification permission." width="1458" height="934" data-path="images/request-permission-flow.png" />

> Follow best practices when requesting notification permission.

## Request permission with Expo Notification

To ensure a smooth user experience, developers are responsible for requesting notification permissions at the appropriate point in the app’s lifecycle, using the expo-notifications API.

This step should be completed before attempting to subscribe the user to push notifications via the Pushbase SDK.

<Info>
  **Prerequisite** : Before initiating a device subscription, you must first request
  notification permissions using
  [`expo-notifications`](https://docs.expo.dev/versions/latest/sdk/notifications/).

  ```js theme={null}
  import * as Notifications from "expo-notifications";

  const { granted } = await Notifications.requestPermissionsAsync({
    ios: {
      allowAlert: true,
      allowBadge: true,
      allowSound: true,
    },
  });

  if (granted) {
    /*After the user grants notification permission, your app is free to register the device for push notifications.*/
  }
  ```

  <Warning>
    Requesting a device subscription before notification permission is granted will result in an error.
  </Warning>
</Info>
