Corona

How to integrate Pushwoosh SDK into your Corona project

Supports iOS, Android

Note:

iOS Simulator can neither subscribe to nor receive push notifications. Android Emulator works fine though.

Download Sample

To integrate Pushwoosh into your Corona app, follow these steps:

1. Configure Firebase push notifications

All new apps must use FCM push notifications. Enable FCM push notifications by following the Corona guideline.

2. Download Pushwoosh module from our Git repository

3. Add push notification handling code to your main.lua file:

main.lua
local pushwoosh = require( "pushwoosh" )

local function onNotification( event )
	native.showAlert( "remote notification", json.encode( event.data ), { "OK" } )
end

local function onRegistrationSuccess( event )
	print( "Registered on Pushwoosh" )
end

local function onRegistrationFail( event )
	native.showAlert( "Notification Registration Failed", "An Error Contacting the Server has Occurred. Please try again later from the application settings.", { "OK" } )                  
end

Runtime:addEventListener( "pushwoosh-notification", onNotification )
Runtime:addEventListener( "pushwoosh-registration-success", onRegistrationSuccess )
Runtime:addEventListener( "pushwoosh-registration-fail", onRegistrationFail )

local launchArgs = ...

pushwoosh.registerForPushNotifications( "PUSHWOOSH_APPLICATION_ID", launchArgs ) -- specify your application Id

Replace "PUSHWOOSH_APPLICATION_ID" with your real Pushwoosh Application ID.

Easy, isnโ€™t it?

Share your feedback with us

Your feedback helps us create a better experience, so we would love to hear from you if you have any issues during the SDK integration process. If you face any difficulties, please do not hesitate to share your thoughts with us via this form.

Last updated