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.
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
1
local pushwoosh = require( "pushwoosh" )
2
3
local function onNotification( event )
4
native.showAlert( "remote notification", json.encode( event.data ), { "OK" } )
5
end
6
7
local function onRegistrationSuccess( event )
8
print( "Registered on Pushwoosh" )
9
end
10
11
local function onRegistrationFail( event )
12
native.showAlert( "Notification Registration Failed", "An Error Contacting the Server has Occurred. Please try again later from the application settings.", { "OK" } )
13
end
14
15
Runtime:addEventListener( "pushwoosh-notification", onNotification )
16
Runtime:addEventListener( "pushwoosh-registration-success", onRegistrationSuccess )
17
Runtime:addEventListener( "pushwoosh-registration-fail", onRegistrationFail )
18
19
local launchArgs = ...
20
21
pushwoosh.registerForPushNotifications( "PUSHWOOSH_APPLICATION_ID", launchArgs ) -- specify your application Id
Copied!
Replace "PUSHWOOSH_APPLICATION_ID" with your real Pushwoosh Application ID.
Easy, isn’t it?
Last modified 2yr ago
Copy link