Corona
ในการผสาน Pushwoosh เข้ากับแอป Corona ของคุณ ให้ทำตามขั้นตอนเหล่านี้:
1. กำหนดค่าการแจ้งเตือนแบบพุชของ Firebase
แอปใหม่ทั้งหมดต้องใช้การแจ้งเตือนแบบพุชของ FCM เปิดใช้งานการแจ้งเตือนแบบพุชของ FCM โดยทำตาม แนวทางของ Corona
2. ดาวน์โหลดโมดูล Pushwoosh จาก Git repository ของเรา
3. เพิ่มโค้ดจัดการการแจ้งเตือนแบบพุชลงในไฟล์ 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
ง่ายใช่ไหมครับ
แบ่งปันความคิดเห็นของคุณกับเรา
Anchor link toความคิดเห็นของคุณช่วยให้เราสร้างประสบการณ์ที่ดียิ่งขึ้น ดังนั้นเรายินดีที่จะรับฟังจากคุณหากคุณมีปัญหาใดๆ ในระหว่างขั้นตอนการผสาน SDK หากคุณประสบปัญหาใดๆ โปรดอย่าลังเลที่จะแบ่งปันความคิดเห็นของคุณกับเราผ่านแบบฟอร์มนี้