Hi,
I have been trying very hard a more than a week to get APP42 push notification with custom data to work. I keep receiving empty table from the push notification on the device. It seems that the custom data is not being push through vua GCM to the device. I have modify the code to do the push via gcm directly and it works perfectly. It seems like a bug in APP42. Also, I noticed that event.sound does not work too. Below is the code in my main.lua to receive the notification.
local function onNotification( event )
if event.type == "remoteRegistration" then
Constants.DeviceToken = event.token
_G.PushToken = event.token
elseif event.type == "remote" then
native.showAlert("Advanced Msg", event.custom.key1 , {"OK"}) -- on APP42 HQ, I have put in key1: 123456
elseif event.type == "local" then
native.showAlert( "Boss Rewards", event.custom.key1 , {"OK"} )
end
end
Runtime:addEventListener( "notification", onNotification )
local options = {
alert = "Wake up!",
badge = 2,
sound = "notification.wav",
custom = { key1 = "Get a job" }
}
-- TEST LOCAL NOTIFICATION
local utcTime = os.date( "!*t", os.time() + 30 )
local notification = notifications.scheduleNotification( utcTime, options )
local launchArgs = ...
if ( launchArgs and launchArgs.notification ) then
onNotification( launchArgs.notification )
end
Can somebody please help urgently?
Thanks.