Marmalade Push SDK Integration

To integrate Pushwoosh into your Marmalade application you need to do simple following steps:

Common for both iOS and Android1. Grab the Marmalade Pushwoosh s3e extension from https://github.com/shaders/push-notifications-sdk/tree/master/SDK%20Sample%20Projects/Marmalade/s3ePushWoosh

  1. Include the extension in your mkb file by adding s3ePushWoosh subproject: subproject ../s3ePushWoosh

  2. Add the following push notifications callbacks in your code:

int32 OnPushRegistered(char* token, void* userData) { //TODO: handle push notifications registration here return 0; } int32 OnPushReceived(char* text, void* userData) { //TODO: handle push notifications here //push notifications comes as JSON string payload: // {"aps":{ // alert = "Hello from Pushwoosh!"; // sound = default; // }, // "onStart":1 // } return 0; } int32 OnPushRegisterError(char* error, void* userData) { //TODO: handle push registration error here return 0; }
4. In your main function add:
if (s3ePushWooshNotificationsAvailable()) { s3ePushWooshRegister(S3E_PUSHWOOSH_REGISTRATION_SUCCEEDED, (s3eCallback)&OnPushRegistered, 0); s3ePushWooshRegister(S3E_PUSHWOOSH_MESSAGE_RECEIVED, (s3eCallback)&OnPushReceived, 0); s3ePushWooshRegister(S3E_PUSHWOOSH_REGISTRATION_ERROR, (s3eCallback)&OnPushRegisterError, 0); s3ePushWooshNotificationRegister(); }
## For iOS
  1. Make sure you use custom Info.plist and add the following information there:
Pushwoosh_APPID YOUR_PUSHWOOSH_APPLICATION_ID
## **For Android**
  1. Make sure you use custom AndroidManifest.xml provided at https://github.com/shaders/push-notifications-sdk/blob/master/SDK%20Sample%20Projects/Marmalade/MarmaladeSample/AndroidManifest.xml

  2. In the same manifest change the value of the “PW_APPID” property to your Pushwoosh Application ID Also change the value of the PW_PROJECT_ID to your GCM Project ID. The GCM Project ID is a number but make sure you prefix it with the letter “A”.

3. Add the following lines to your mkb file in the deployments section:
android-manifest = AndroidManifest.xml android-external-jars="Pushwoosh.jar"
See this guide for more information on getting your GCM Project Id: [http://www.pushwoosh.com/programming-push-notification/enabling-gcm-services-for-google-api/](http://www.pushwoosh.com/programming-push-notification/enabling-gcm-services-for-google-api/)

IMPORTANT! Make sure you leave the first letter (“A”) when entering your Project ID.

If you have any problems, we have sample project for you! It is available here: https://github.com/shaders/push-notifications-sdk/tree/master/SDK%20Sample%20Projects/Marmalade/MarmaladeSample

**Expert Mode On!**

Marmalade Push Notifications SDK API:

** * Registers for push notifications. */ s3eResult s3ePushWooshNotificationRegister(); /** * Returns push notifications token if available */ char * s3ePushWooshGetToken(); /** * Unregisters from push notifications (Android only) */ s3eResult s3ePushWooshNotificationUnRegister(); /** * Sets integer tag */ s3eResult s3ePushWooshNotificationSetIntTag(const char * tagName, int tagValue); /** * Sets string tag */ s3eResult s3ePushWooshNotificationSetStringTag(const char * tagName, const char * tagValue);
That’s it! How easy is that?