Hi all,
I’m trying to use local notification in my game.
I’m using this code to let the user know the daily bonus is ready:
My main.lua:
\_G.DailyBonusTime = 86400 local function notificationListener( event ) if ( event.type == "remote" ) then --handle the push notification elseif ( event.type == "local" ) then --handle the local notification \_G.DailyBonusReady = true print("Notification Listener!") end end local futureTime = os.date( "!\*t", os.time() + (\_G.DailyBonusTime-1) ) local options = { alert = "Your daily bonus is ready!", badge = 0, sound = "sounds/winfree.mp3", custom = { msg = "Alarm" } } local notificationID = system.scheduleNotification( \_G.DailyBonusTime, options )
Problem is, the notification is fired about once an hour instead. No clue why.
If I change it to 20 secs instead of 86400, it works fine.
I’m clueless.
The other weird thing is, if the notification fires, it sets _G.DailyBonusReady to true
In my menu.lua I run a timer to check the remaining time, and check if _G.DailyBonusReady = true, so the user can get the bonus. But even when the notification fires every hour, the timer still doesn’t see that _G.DailyBonusReady = true.