# How to ask for push permission with a pre-permission in-app

A pre-permission in-app is your own message that comes before the system push permission prompt. It explains why notifications are useful, and the system prompt appears only after the user says yes in it. This guide shows the in-app on iOS and Android when an event happens, for example right after onboarding, and builds a segment of users who still have push disabled.

<Aside type="note" title="Use a different guide if">
* Your team will ship an iOS-only prompt in app code (not editable in the Control Panel, not started by a Journey event): [iOS push primer](/developer/pushwoosh-sdk/ios-sdk/ios-push-primer/).
* You need to re-engage users who already disabled push or never granted it (recovery only, not the first ask): [Create opt-out recovery popups](/product/content/in-apps/create-opt-in-and-opt-out-recovery-popups-in-pushwoosh-in-app-editor/).
</Aside>

## Prerequisites

* The Pushwoosh SDK integrated in your iOS or Android app. See [Pushwoosh SDK overview](/developer/pushwoosh-sdk/pushwoosh-sdk-overview/).
* A pre-permission in-app template with an accept and a decline button. See [Create a pre-permission in-app](/product/content/in-apps/show-in-app-before-push-permission-prompt/).
* A custom event your app sends at the moment you ask. Your developers set it up as described below.

<Aside type="caution" icon="setting" title="Developer assistance needed">
Pushwoosh never shows the system permission dialog by itself: it appears only when the user taps the accept button in your in-app. Your developers make sure the app doesn't request push permission earlier, including on first launch, and send the custom event you choose in [Choose when to ask](#choose-when-to-ask) with [`postEvent`](/developer/api-reference/user-centric-api#postevent). Share the [events guide](/product/audience-data-and-segmentation/events/#implementation) with them.
</Aside>

## Choose when to ask

Pick the moment before you build the journey, because your developers send the event at that moment.

<Aside type="caution" title="One chance on iOS">
On iOS, the system prompt appears only once per install. If the user taps **Don't Allow**, the app can't show it again and push stays off until they turn notifications on in Settings. Ask in your in-app first. Then the system prompt reaches only users who already said yes.
</Aside>

Use these guidelines:

| Do | Don't |
| --- | --- |
| Ask right after onboarding | Ask on first launch or during the tutorial |
| Ask when the user taps a feature that needs notifications | Let the app request permission in code before the in-app |
| Explain in the in-app why notifications are useful | Show the system prompt before the explanation |

1. Choose the moment from the table. This guide asks right after onboarding.
2. Agree with your developers on a custom event name for that moment, for example `onboarding_completed`. For a feature that needs notifications, an event such as `locked_feature_tapped` works the same way.

## Build the journey

A device that hasn't registered for push yet has no push token, so a push notification can't reach it. The journey shows an in-app instead, started by the event.

1. Go to **Customer Journey Builder** → **Create Campaign**.
2. Add a [Trigger-based entry](/product/customer-journey/journey-elements/entry-elements/trigger-based-entry/) and select `onboarding_completed` as the event.
3. Add an In-app element and select your [pre-permission template](/product/content/in-apps/show-in-app-before-push-permission-prompt/). See [Send in-apps via Customer Journey](/product/messaging-channels/in-apps/send-in-apps/send-in-apps-via-customer-journey/).
4. Launch the journey.

The in-app doesn't appear the instant the event fires. The device has no push token yet, so the in-app waits for the next time the user opens the app.

Every user who completes onboarding sees the in-app once. The display condition from [Skip the prompt for users who already opted in](/product/content/in-apps/show-in-app-before-push-permission-prompt/#skip-the-prompt-for-users-who-already-opted-in) hides it from users who already allowed push. If your event can fire again for the same user, such as `locked_feature_tapped`, set a [campaign entry limit](/product/customer-journey/journey-settings/#campaign-entry-limit) so the in-app doesn't repeat.

## Build a segment of users who still have push disabled

The **Push Alerts Enabled** tag is `false` when the device can't show push alerts. On iOS and on Android 13 and later, this includes devices whose users haven't seen the system dialog yet, so the segment holds both users who declined and users who were never asked. On Android 12 and earlier, notifications are allowed without a dialog, so these devices are in the segment only if the user turned notifications off. To separate users who were never asked from users who declined, use the [Push Permission Status](/product/pushwoosh-knowledge-hub/push-permission-status/) tag instead.

1. In the segment builder, add a filter by the **Push Alerts Enabled** tag.
2. Set the operator to **is false**. See [Boolean tag operators](/product/audience-data-and-segmentation/segmentation/create-segments/by-tags/#boolean-tag-operators).

Use this segment to hold back a repeat prompt from users who still don't have push enabled, or to run a periodic win-back journey.

## Check the results

To test both buttons, use two test devices (or two fresh installs) on iOS or on Android 13 and later that haven't granted or denied push yet, one for each button. Android 12 and earlier don't show a permission dialog. The system prompt appears only once per install, so one device can't test both.

1. On both devices, fire `onboarding_completed` from the app.
2. On both devices, reopen the app and confirm the journey delivers your in-app.
3. On the first device, tap the accept button and confirm the system permission dialog appears.
4. On the first device, tap **Allow** in the system dialog.
5. On the second device, tap the decline button and confirm the in-app closes with no system dialog.
6. Reopen the app on both devices.
7. In [User Explorer](/product/audience-data-and-segmentation/user-explorer/#test-devices-tab), open each device from the **Test devices** tab, go to the **Devices and platforms** tab, and check **Push Alerts Enabled** in the device's tags: `true` on the first device, `false` on the second.

## Next steps

* [Create opt-out recovery popups](/product/content/in-apps/create-opt-in-and-opt-out-recovery-popups-in-pushwoosh-in-app-editor/#opt-out-recovery-popup): win back users from the segment above with the same **Push Alerts Enabled** tag.
* [Push Permission Status](/product/pushwoosh-knowledge-hub/push-permission-status/): target users who were never asked separately from users who declined.