我开发了一个提醒应用程序,并使用 timer.performWithDelay 函数来调用我指定要完成的任务的函数。它在模拟器上运行良好。我想在设备上运行它,因为我需要使用 system.scheduleNotification 。我无法理解如何使用它并签入模拟器。我正在分享我编写的代码。
local function onComplete( event )
print( "index => ".. event.index .. " action => " .. event.action )
local action = event.action
if "clicked" == event.action then
if 2 == event.index then --pressing snooze and setting snooze time to 1mins
audio.stop()
print("**SNOOZED**")
forAlarm1 = timer.performWithDelay (60*1000, compareTime)
elseif 1==event.index then --pressing ok and setting the alarm to repeat mode
print("**ALARM SET TO REPEAT**")
audio.stop()
end
end
结尾
function compareTime()
print("CompareTime is called")
timer.performWithDelay (7*24*3600*1000, compareTime)
audio.play(alarm)
local alert = native.showAlert( "Garbage Collection Reminder", "It's Time", { "OK", "SNOOZE" },onComplete)
end
forAlarm = timer.performWithDelay (delay*1000, compareTime)
有人可以告诉我应该如何修改我的代码以在设备上运行它吗???