You can find the OneSignal integration at /providers/OneSignalProvider.tsx and it is initialized at /app/auth.tsx like this:

OneSignalProvider.tsx
useEffect(()  =>  {
	OneSignalProvider()
},  [])

If you want to disable the Push Notifications just comment out this part of the code.

Setting up OneSignal

1

Create an account

Go to the OneSignal website and create an account.

2

Setting up Messaging Channels

In your Quick Start Guide click on:

  • Set up Messaging Channels for Your App
  • Then on Push Notifications

3

Set up your first channel

  • Click on Google Android (FCM)

4

Firebase console

5

Firebase project settings

  • Now once you have created a new Firebase project go to Project Settings

6

Service account

  • Now go to Service Accounts section under Project Settings.
  • Click on Generate new private key and download the JSON file.

7

Google Android Configuration

  • Now go back to OneSignal.
  • Upload .json key.
  • Click on Save & Continue

8

Target SDK

  • Click on React Native / Expo.
  • Click on Save & Continue

9

App Id

  • Copy the App Id.
  • Save the App Id in your .env file at ONESIGNAL_APP_ID=.

10

Apple set up

Now you have to that same steps for iOS but instead of Firebase service key you will need a .p8 key from Apple Developer Portal, to do this:

  • Go to this page.
  • Write a key name.
  • Check Apple Push Notifications service (APNs).
  • Click Register.
  • Download the key.

Remember that the key can be downloaded only once so store it somewhere safe and don’t lose it. And to register .p8 key at Apple Developer portal you have to be enrolled in Apple Developer program.

11

Run the app

  • Now you need to run npx expo prebuild in your terminal.
  • Then run npx expo run ios to launch on iOS or npx expo run android to launch on Android.

Congratulations! You have successfully set up push notifications with One Signal.

Other tutorials

Set up development environment

Set up your development environment