> For the complete documentation index, see [llms.txt](https://doc.newsfreak.mrb-lab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.newsfreak.mrb-lab.com/app-setup/3.-push-notification-setup/3.3-onesignal-setup.md).

# 3.3 OneSignal Setup

### 3.1.1 Android Setup for Onesignal

1. Create your Onesignal account from [here](https://dashboard.onesignal.com/) or use your existing Onesignal account and create an app.

<figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2F1BniTfyhhJdOCsVfzSYW%2Fimage.png?alt=media&amp;token=c480a434-cbcd-4272-bb64-8099e93cf245" alt=""><figcaption></figcaption></figure>

2. Enter your app name select Google Android FCM and click on Next.

<figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2FIIi2S8Ya9rQC3zJoTJGu%2Fimage.png?alt=media&amp;token=5a4d0141-dc69-44bb-8035-290452332d53" alt=""><figcaption></figcaption></figure>

3. For the next step, you need to download your **Firebase Admin SDK** from your Firebase project. Follow [<mark style="color:purple;">this (2 & 3)</mark>](https://documentation.onesignal.com/docs/android-firebase-credentials) to download the file and upload the JSON file here.

<figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2FX2zUTPFFPWVKqT7ZS8NS%2Fimage.png?alt=media&amp;token=b802d6aa-b91c-4889-b4fc-7303568eb110" alt=""><figcaption></figcaption></figure>

4. In the next step, select **Flutter** as your target SDK.

<figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2FIVQ0MC5xgAkHKDxvDWoQ%2Fimage.png?alt=media&amp;token=10e0bbda-d341-47f3-a86d-0440d7000af7" alt=""><figcaption></figcaption></figure>

5. Click Save and Done to complete the Android setup.

### 3.1.2 iOS Setup for Onesignal

1. From 3.2, you will get your key (.p8 file) from your Apple developer account. For more details, you can check [this](https://documentation.onesignal.com/docs/ios-p8-token-based-connection-to-apns) out.
2. From Onesignal > Your app > Settings > Platforms, Select **Apple iOS.**

<figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2FiqeQubGsEkVIYblJzq6g%2Fimage.png?alt=media&amp;token=726acee0-efc4-4f19-86ed-b47ca3cc6d06" alt=""><figcaption></figcaption></figure>

3. Now, upload your key, Key ID, Team ID, and iOS package name.

<figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2FkJyF1fBWFpqjukImIxCo%2Fimage.png?alt=media&amp;token=fa4b4b0b-efa3-4702-9199-ab5c9ea81097" alt=""><figcaption></figcaption></figure>

4. Select Flutter as Your SDK if you get any sdk steps after this.
5. Save and activate this configuration.

### 3.1.3 WordPress Setup for Onesignal

1. From your WordPress Dashboard > Onesignal Push > Configuration, Add your **Onesignal App ID**, and **Rest API key**.

{% hint style="info" %}
You can get both the **Onesignal App ID** and **Rest API key** from your Onesignal Account > Your app > Settings > Keys & IDs.
{% endhint %}

<div align="left"><figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2FBAXyEEgBoELelKbGXNoi%2FScreenshot%202024-08-07%20at%2010.49.23%20PM.png?alt=media&amp;token=30fc3205-26ab-4d9b-a667-553e03d6ab55" alt=""><figcaption></figcaption></figure></div>

2. **Enable** Send notifications additionally to iOS & Android Platforms.
3. Save the configurations.

After this setup, you will get an option in your editor to send notifications on post updates.

<figure><img src="https://193695234-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuVX9DkcSpz5pWRDwpVCd%2Fuploads%2Faxa2dx10Jy5JKqfYOKZK%2Fimage.png?alt=media&amp;token=6536bc8d-82c1-4f3a-8b18-78b69a6a72ad" alt=""><figcaption></figcaption></figure>

### 3.1.4 Update OneSignal App ID in the code

From Onesignal > Your app > Settings > Keys & IDs, You will get your **Onesignal App ID**. Copy this and update the ID in the **lib/config/config.dart** file.
