Push Notification Setup
This guide will walk you through the process of setting up push notifications for your app.
Prerequisites
- You have an apple developer account (opens in a new tab) for iOS
- You have an android developer account (opens in a new tab) for Android
- You have completed the Setup guide
- OneSignal Account (opens in a new tab)
For a more detailed guide on setting up iOS push notifications, please refer to the official OneSignal documentation (opens in a new tab).
Setup
Generate a p8 key
Go to your apple developer account apple developer account (opens in a new tab), under Certificates, Identifiers & Profiles click on Keys and add a new Key via the blue button.
Download the p8 key and save it somewhere safe. You can only download the p8 key once. Also, copy the Key ID and Team ID from the Key section.
You can only have up to two p8 keys in your account. If you need to generate a new p8 key, you will need to revoke the old one first.
OneSignal Setup
Go to your OneSignal Dashboard (opens in a new tab). Click on Add New App. Enter a Name for your app and select the Organization or create a new one. Select Apple iOS (APNs) as the platform (You can add more platforms later).
Add your p8 key to OneSignal
Upload your p8 key, Key ID and Team ID from the previous step. Also, add your Bundle ID of your app (you can find this in your config.js).
Get your OneSignal App ID
Go to your OneSignal Dashboard (opens in a new tab). Click on your app and go to the Settings>Keys & IDs tab. Copy your App ID and add it to your environment file.
EXPO_PUBLIC_ONE_SIGNAL_APP_ID="<your-onesignal-app-id>"
Now you're ready to test push notifications
That's it! You can now run your local development and test push notifications in the simulator. For sending push notifications check our sending push notifications guide.