Passer au contenu

Corona

Télécharger l’exemple

Pour intégrer Pushwoosh dans votre application Corona, suivez ces étapes :

1. Configurer les notifications push Firebase

Toutes les nouvelles applications doivent utiliser les notifications push FCM. Activez les notifications push FCM en suivant le guide Corona.

2. Téléchargez le module Pushwoosh depuis notre dépôt Git

3. Ajoutez le code de gestion des notifications push à votre fichier main.lua :

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

Facile, n’est-ce pas ?

Partagez vos commentaires avec nous

Anchor link to

Vos commentaires nous aident à créer une meilleure expérience. Nous serions donc ravis de connaître votre avis si vous rencontrez des problèmes lors du processus d’intégration du SDK. Si vous rencontrez des difficultés, n’hésitez pas à nous faire part de vos réflexions via ce formulaire.