I’m trying to show a native alert, which shows a message saying “the session wille expire in 10 seconds”, and I want it to countdown from 10 to 0, after which the alert should disappear if no user input is given.
How can I achieve this?
I have tried:
local dismissTime = 10 local alert = native.showAlert( "Session Expiry", "This session will expire in" .. dismissTime .. "seconds", { "Extend Session", "Log out" }, onComplete ) local function updateAlert() if dismissTime \>= 1 then dismissTime = dismissTime - 1; else native.cancelAlert(alert) end timer.performWithDelay( 1000, updateAlert )
The above decrements my dismissTime variable, but it does not update the value in the alert, which just keeps showing 10 seconds. Any help is appreciated!