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

1. Configure your Corona project

The first thing you need to do is make sure a specific table is included within your config.lua file. You can simply copy/paste from the example, but ensure that the ‘notification’ table is within the ‘application’ table, not the ‘content’ table.

config.lua

application = { content = { width = 320, height = 480 }, notification = { iphone = { types = { "badge", "sound", "alert" } } } }
The presence of a ‘notification’ table in your config.lua is what will trigger the “Do you wish to allow ‘Your App’ to receive Push Notifications?” popup when the user first launches your app.

2. Add handling code to your main.lua file

main.lua

local launchArgs = ... local json = require "json" if launchArgs and launchArgs.notification then native.showAlert( "launchArgs", json.encode( launchArgs.notification ), { "OK" } ) end -- notification listener local function onNotification( event ) if event.type == "remoteRegistration" then native.showAlert( "remoteRegistration", event.token, { "OK" } ) elseif event.type == "remote" then native.showAlert( "remote", json.encode( event ), { "OK" } ) end end Runtime:addEventListener( "notification", onNotification )
The notification listener will display a native alert with the device token every time an event.type of “remoteRegistration” is dispatched (every time the app is launched).

If the app receives a notification event with an event.type of “remote”, the app will simply show a native alert with the event table serialized into a JSON string so you can see the notification details.

The app will do a similar thing if launched from a cold start in response to a push notification that was received (via launchArgs.notification table).

3. Modify “remoteRegistration” handler to send the device token to the Pushwoosh server.

local function onNotification( event ) if event.type == "remoteRegistration" then local DeviceID = event.token local PW_APPLICATION = "PUHSOOWH_APPLICATION_ID" --use your app id in pushwoosh local PW_URL = "https://cp.pushwoosh.com/json/1.3/registerDevice" local function networkListener( event ) if ( event.isError ) then --error occurred notify user native.showAlert( "Notification Registration Failed", "An Error Contacting the Server has Occurred. Please try again later from the application settings.", { "OK" } ) else --Registration worked perform any action you like here end end local commands_json = {  ["request"] = {                                ["application"] = PW_APPLICATION,                                ["push_token"] = DeviceID,                                ["language"] = system.getPreference("ui", "language"),                                ["hwid"] = system.getInfo("deviceID"),                                ["timezone"] = 3600, -- offset in seconds                                ["device_type"] = 1 } } local jsonvar = {} jsonvar = json.encode(commands_json) local post = jsonvar local headers = {} headers["Content-Type"] = "application/json" headers["Accept-Language"] = "en-US" local params = {} params.headers = headers params.body = post network.request ( PW_URL, "POST", networkListener, params ) end end
That’s it! Easy, isn’t it?
Please refer to the http://blog.anscamobile.com/2011/12/push-notifications-for-ios-in-corona-sdk/ for more information.

Thanks to Will Kruss with his app (http://www.iphonenewsexpert.com) for helping with Corona integration.

NOTE: Simulator is not able neither to subscribe nor receive push notifications.