OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Cordova SDK Setup

Instructions for adding the OneSignal SDK to your Cordova app for iOS, Android, and derivatives like Amazon


OneSignal Cordova SDK Version 3 - Beta!

Take a look at our OneSignal Cordova SDK documentation to learn more about the Cordova 2.x to 3.0.0 upgrade.

We are looking for feedback. Help us make our SDK better. Leave your feedback in this Github issue.


Looking for Ionic setup?

See our Ionic SDK Setup guide instead.

Step 1. Requirements

iOS Requirements

  • An iOS device (iPhone, iPad, iPod Touch) to test on. The Xcode simulator doesn't support push notifications so you must test on a real device.
  • A Mac with Xcode 12+.
  • An iOS Push Certificate.
  • Cordova [email protected]+
  • CocoaPods - Install with the following from the Terminal:
sudo gem install cocoapods
pod repo update

Android Requirements

Amazon & Huawei Requirements

Follow these instructions if your app is distributed on the Amazon AppStore and/or the Huawei AppGallery.

Step 2. Import OneSignal Plugin

You should remove any other push SDKs that you are not using – otherwise, you may see duplicate notifications being sent to your users.

Run the following from your project directory:

cordova plugin add [email protected] --save

Step 3. Add Required Code

3.0 Add the following to the bottom of the first Javascript file that loads with your app. This is <project-dir>/www/js/index.js for most Cordova projects.

// Add to index.js or the first page that loads with your app.
var app = {
    // Application Constructor
    initialize: function() {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);

    // deviceready Event Handler
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function() {

    receivedEvent: function() {
    //Remove this method to stop OneSignal Debugging 
    //window.plugins.OneSignal.setLogLevel({logLevel: 6, visualLevel: 0});
    var notificationOpenedCallback = function(jsonData) {
        console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
    // Set your iOS Settings
    var iosSettings = {};
    iosSettings["kOSSettingsKeyAutoPrompt"] = false;
    iosSettings["kOSSettingsKeyInAppLaunchURL"] = false;
    // The promptForPushNotificationsWithUserResponse function will show the iOS push notification prompt. We recommend removing the following code and instead using an In-App Message to prompt for notification permission (See step 6)
    window.plugins.OneSignal.promptForPushNotificationsWithUserResponse(function(accepted) {
        console.log("User accepted notifications: " + accepted);

3.1 Update initialization parameters. Replace YOUR_APPID with your OneSignal App Id, available in the OneSignal dashboard under Settings > Keys & IDs.


Amazon ADM Apps

Place your api_key.txt file into your <project-dir>/platforms/android/assets/ folder.

To create an api_key.txt for your app, follow our Generate an Amazon API Key.

Step 4. iOS Setup (Skip if your app is Android-only)

4.0 In /platforms/ios Open the .wcworkspace project in Xcode.
4.1 Select the root project, and under Signing & Capabilities, enable Push Notifications.
4.2 Next, enable Background Modes and check Remote Notifications.

iOS Service Extensions

Highly recommended: This step is optional but highly recommended. The OneSignalNotificationServiceExtension allows your application (in iOS) to receive rich notifications with images and/or buttons, along with Badges and advanced analytics like Outcomes.

4.3 Please follow the Notification Service Extension guide (only Steps 2). Make sure to use Objective-C in this step, then come back to this page and continue following the steps below.

4.4 Select the new OneSignalNotificationServiceExtension Target, select Build Settings, then search for Code Signing Entitlements.

4.5 Delete both Debug and Release entries so they are blank.

4.6 Select Build Phases and expanded the"Link Binary With Libraries" section. Press the + and add the following frameworks:

  • SystemConfiguration.framework
  • UIKit.framework.
  • CoreGraphics.framework
  • WebKit.framework

4.7 Press the + and click Add Other... > Add Files

4.8 Navigate to > platforms > ios > Pods > OneSignal > iOS_SDK > OneSignalSDK > Framework > Select OneSignal.framework and click Open

4.9 You should now see all 5 frameworks listed.

4.10 Go to the Notification Service Extension's General Xcode project settings, and set the Deployment Target to be iOS 10 if you have not done so already.

iOS - Add App Groups (Recommended)

In order for your application to use Confirmed Deliveries and increment/decrement Badges through push notifications, you need to setup an App Group for your application.

Please follow the iOS SDK App Groups setup guide to add the OneSignal App Group in your app.

iOS Automatic Builds (Optional)

If you are using an automated build system, you may run into issues where the Push Notification capability is not enabled for your project. In order to resolve this problem, you can follow these steps:

4.11 In your Xcode project, make sure the Push Notifications capability (as well as any other capabilities your app needs).

4.12 Close the Xcode project. In the /platforms/ios folder you will see a {yourProjectName}.entitlements file. Copy this file to the root of your Cordova project.

4.13 Edit your config.xml file to include the following. Make sure to replace [yourProjectName] with the name of your project.

<platform name="ios">
    <resource-file src="[yourProjectName].entitlements" />

Step 5. Run Your App and Send Yourself a Notification

Run your app on a physical device to make sure it builds correctly. Note that the iOS Simulator does not support receiving remote push notifications.

  • Android devices should be subscribed to push notifications immediately upon opening the app.
  • iOS devices should be prompted to subscribe to push notifications if you used the example setup code provided.

Check your OneSignal Dashboard Audience > All Users to see your Device Record.

Then head over to Messages > New Push to Send your first Push Notification from OneSignal.



If you run into any issues please see our Cordova Variants troubleshooting guide.

Try the example project on our Github repository.

If stuck, feel free to contact [email protected] for assistance.

Step 6. Prompt Your Users to Subscribe (Recommended for iOS)


Apple's Human Interface Guidelines recommend that apps "Create an alert, modal view, or other interface that describes the types of information they want to send and gives people a clear way to opt in or out."

OneSignal provides an easy option for a "soft-prompt" using In-App Messages to meet this recommendation and have a better user experience. This also permits you to ask for permission again in the future, since the native permission prompt can no longer be shown in your app if the user clicks deny.

See our iOS Push Opt-In Prompt for details on implementing this.


Setup Complete!

Visit Mobile Push Tutorials for next steps.

Updated 6 days ago

Cordova SDK Setup

Instructions for adding the OneSignal SDK to your Cordova app for iOS, Android, and derivatives like Amazon

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.