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    Support

Intel XDK Setup

OneSignal Intel XDK Setup Guide. Works with iOS, Android (and derivatives like Amazon) and Windows Phone 8.1.

For Developers

Update SDK

If you already have an app with the Intel XDK, your app should remain up to date with the latest OneSignal SDK since your project is built remotely. If you have not set up an app yet, follow the instructions below.


Setup SDK

Generate Credentials

Before setting up Intel XDK, you must generate the appropriate credentials for the platform(s) you are releasing on:

iOS - Generate an iOS Push Certificate

Android - Generate a Google Server API Key

Amazon - Generate an Amazon API Key

1. Import OneSignal Plugin

1.1. Click the Projects menus in the top left and scroll down to "Cordova Hybrid Mobile App Settings". Expand "Plugin Management" and click "Add Plugins to this Project".

1.2. Select "Third-Party Plugins" then pit "Git repo" as the Plugin source. Enter the following as the "Repo URL":

https://github.com/one-signal/OneSignal-Cordova-SDK.git#PGB-Compat

1.3. Android - Added the required Android Decencies plugin.

  • https://github.com/OneSignal/OneSignal-Cordova-Dependencies-Compat

1.4. Windows Phone 8.1 - Open intelxdk.config.additions.xml and add the following lines.

<preference name="windows-target-version" value="8.1" />
<preference name="WindowsToastCapable" value="true" />

2. Add required code

2.1. Add the following to the first javascript file that loads with your app.

  • This is <project-dir>/www/js/index.js for most Cordova projects.
  • Add this to your app.js.
// Add to index.js or the first page that loads with your app.
// For Intel XDK and please add this to your app.js.

document.addEventListener('deviceready', function () {
  // Enable to debug issues.
  // window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
  
  var notificationOpenedCallback = function(jsonData) {
    console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
  };

  window.plugins.OneSignal
    .startInit("YOUR_APPID")
    .handleNotificationOpened(notificationOpenedCallback)
    .endInit();
  
  // Call syncHashedEmail anywhere in your app if you have the user's email.
  // This improves the effectiveness of OneSignal's "best-time" notification scheduling feature.
  // window.plugins.OneSignal.syncHashedEmail(userEmail);
}, false);

2.2 Update initialization parameters

Replace YOUR_APPID with your OneSignal AppId, available in Keys & IDs


SDK API

Check out our Intel XDK Reference for more OneSignal functions.

Push Notification Testing Requirements

  • iOS - Must test on a real device, Simulator does not support Apple push notifications.
  • Android
    • You MUST build and install your app's APK.
    • You may use an emulator but it must have an updated version of Google Play services installed.
  • Does NOT work with the Intel XDA Debug mode.

Troubleshooting

If you run into any errors see Troubleshooting Cordova Variants, our our general Troubleshooting section.

Intel XDK Setup

OneSignal Intel XDK Setup Guide. Works with iOS, Android (and derivatives like Amazon) and Windows Phone 8.1.

For Developers