Skip to content

About

The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Β 
Β 

Repository files navigation

Welcome to onesignal-expo-plugin πŸ‘‹

Version Documentation Maintenance Twitter: onesignal

The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.

🚧 In Beta 🚧

Overview

This plugin is an Expo Config Plugin. It extends the Expo config to allow customizing the prebuild phase of managed workflow builds (no need to eject to a bare workflow). For the purposes of OneSignal integration, the plugin facilitates automatically generating/configuring the necessary native code files needed to get the OneSignal React-Native SDK to work. You can think of adding a plugin as adding custom native code.

Supported environments:


Install

expo install onesignal-expo-plugin
yarn add react-native-onesignal

Configuration in app.json / app.config.js

Plugin

Add the plugin to the plugin array:

app.json

{
  "plugins": [
    [
      "onesignal-expo-plugin",
      {
        "mode": "development",
      }
    ]
  ]
}

or

app.config.js

export default {
  ...
  plugins: [
    [
      "onesignal-expo-plugin",
      {
        mode: "development",
      }
    ]
  ]
};

Plugin Prop

You can pass props to the plugin config object to configure:

Plugin Prop
mode required Used to configure APNs environment entitlement. "development" or "production"
devTeam optional Used to configure Apple Team ID. You can find your Apple Team ID by running expo credentials:manager e.g: "91SW8A37CR"
iPhoneDeploymentTarget optional Target IPHONEOS_DEPLOYMENT_TARGET value to be used when adding the iOS NSE. A deployment target is nothing more than the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: "12.0".

OneSignal App ID

Add your OneSignal App ID to your Expo constants via the extra param:

Example:

{
  "extra": {
    "oneSignalAppId": "<YOUR APP ID HERE>"
  }
}

You can then access the value to pass to the setAppId function:

import OneSignal from 'react-native-onesignal';
import Constants from "expo-constants";
OneSignal.setAppId(Constants.manifest.extra.oneSignalAppId);

Alternatively, pass the app ID directly to the function:

OneSignal.setAppId("YOUR-ONESIGNAL-APP-ID");

Versioning

In your configuration file, make sure you set:

Property Details
version Your app version. Corresponds to CFBundleShortVersionString on iOS. This value will be used in your NSE* target's plist file.
ios.buildNumber Build number for your iOS standalone app. Corresponds to CFBundleVersion and must match Apple's specified format. This value will be used in your NSE* target's plist file.

* NSE = Notification Service Extension. Learn more about the NSE here.

Run

$ expo prebuild --clean

# Build your native iOS project
$ expo run:ios

# Build your native Android project
$ expo run:android

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

OneSignal

πŸ“ License

Copyright Β© 2021 OneSignal.
This project is MIT licensed.

About

The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages