Hey! These docs are for version 7.0, which is no longer officially supported. Click here for the latest version, 9.0!

Marmalade SDK Setup

OneSignal Marmalade SDK Setup Guide. Works with iOS, Android (and derivatives like Amazon), and Windows Phone 8.0 & 8.1.

Required For Setup

🚧

Marmalade 7.8+

To use the latest OneSignal SDK for Marmalade please update to Marmalade 7.8 or later. OneSignal may work on older versions of Marmalade but is not guaranteed.

Setup SDK

Generate Credentials

Before setting up the Marmalade SDK, 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. Download latest OneSignal SDK

1.1. Download the latest extension.

1.2. Place the s3eOneSignal folder one level up from your project folder.

2. Add the extension to your project

2.1. Open your project's .mkb file and add the following.

options
{
    module_path=../s3eOneSignal
}
subproject ../s3eOneSignal/s3eOneSignal.mkf

deployments
{
  android-extra-strings='(gps_app_id, 999)'  ## required by google-play-services.

  iphone-link-opts="-weak_framework UIKit"

    wp8-custom-manifest=OneSignalCustomWP8Manifest.xml
    wp8-custom-manifest-fill=0
}

3. Add required code

3.1. Open the .cpp file that contains your int main() function.

3.2. Include s3eOneSignal.h

#include "s3eOneSignal.h"

3.3. Add the following 3 lines to the top of the main function and update them as appropriate (below)

OneSignalInitialize("5eb5a37e-b458-11e3-ac11-000c2940e62c", "703322744261", (OneSignalNotificationReceivedCallbackFn)HandleReceivedNotification, true);
s3eDeviceRegister(S3E_DEVICE_PAUSE, &OneSignalSystemPaused, NULL);
s3eDeviceRegister(S3E_DEVICE_UNPAUSE, &OneSignalSystemResume, NULL);

Update OneSignalInitialize's 1st parameter with your OneSignal App Id, which can be found in Keys & IDs.

Android, Amazon - update the 2nd parameter with your Google Project Number.

iOS, Windows Phone - update the 2nd parameter with NULL.

3.4. Add the following HandleReceivedNotification function above your int main() function and customize to your liking.

static void HandleReceivedNotification(OneSignalNotificationReceivedResult* result, void* userData) {
    char buffer[1024];
    sprintf(buffer, "NOTIFICATION RECIEVED CALLBACK MESSAGE: %s", result->m_Message);
    s3eDebugOutputString(buffer);
    if (result->m_AdditionalData != NULL) {
        char buffer2[1024];
        sprintf(buffer2, "NOTIFICATION RECIEVED CALLBACK ADDITIONALDATA: %s", result->m_AdditionalData);
        s3eDebugOutputString(buffer2);
    }
}

4. Android Setup

Android

4.1. Build like normal, no extra setup steps!

4.2. If you are also using the s3eFacebook plugin you will need to follow these additional steps.

5. Amazon Setup

Amazon

5.1. Open your project's .mkb file and add the following:

assets
{
    android/assets/api_key.txt
}

5.2. Place your api_key.txt file into <project-folder>/android/assets/. Create the folders if you do not have them yet.

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

6. iOS Setup

iOS

6.1. Build like normal, no extra setup steps!

👍

You're Done!

Next up: Send your first push notification via the OneSignal Dashboard