Does OnAlarm function works?

22 views
Skip to first unread message

Dab

unread,
Jan 26, 2023, 10:28:58 PMJan 26
to DroidScript
Hi, maybe it's a silly question, but I'm a beginner with DS. Is it possible that OnAlarm function doesn't work properly?

Steve Garman

unread,
Jan 27, 2023, 3:53:55 AMJan 27
to DroidScript
The simple code below works for me 

function OnStart()
{
   lay = app.CreateLayout("Linear", "VCenter,FillXY")
   btn = app.AddButton(lay, "Test")
   btn.SetOnTouch(btn_OnTouch)
   app.AddLayout(lay)
}

function btn_OnTouch()
{
   var now = Date.now()
   app.SetAlarm("Set", 1234, OnAlarm, Date.now() + 3000);
   app.Exit(  )
}

function OnAlarm()
{
   app.ShowPopup("Alarm")
}

Димыч Вакулин

unread,
Jan 27, 2023, 5:44:02 AMJan 27
to DroidScript
SetAlarm works if the application running this function is in the foreground. If you run the SetAlarm function and collapse the application, nothing will happen (the OnAlarm function will not be called). The newer the Android version, the less freedom the programmer has ((

пятница, 27 января 2023 г. в 11:53:55 UTC+3, steve....@gmail.com:

Right2TheV0id

unread,
Jan 27, 2023, 10:47:01 AMJan 27
to DroidScript
Dab are you using the latest DS version?
Reply all
Reply to author
Forward
0 new messages