Alarm

112 views
Skip to first unread message

Jacob

unread,
Jul 6, 2011, 3:25:39 PM7/6/11
to Tasker
Hey Guys,

I'm using Minimalistic Text widgets to display information about my
phone. I noticed that the lockscreen has a next alarm time so I was
wondering if I could use tasker to create a variable with the next
alarm time in it to display with minimalistic?

fubaya

unread,
Jul 6, 2011, 9:47:49 PM7/6/11
to Tasker
I've played around with the alarm database before and this will work
if you're rooted. If you're not rooted, I think you're out of luck
because I don't think Tasker itself can read the alarm database. You
don't have to be root to read the file but you have to be rooted to
have the tools to read the file. There may be a non-rooted option, I
just don't know. There is surely an API call to get it without having
to read the database, but who knows.

Anyway, run this command with the locale execute plugin:

sqlite3 -separator " : " /data/data/com.android.deskclock/databases/
alarms.db "SELECT * from alarms;" | grep ': 1 : 1 : :' | awk -F' '
'{ print $3 $4 $5 }' | sort -n | head -n1 > /sdcard/nextalarm

then read the nextalarm file with Tasker.

There is one downside. It doesn't work if the alarm is set to the
minutes between 1 and 9 because the data isn't stored with a 0 before
the minutes. So 7:00 becomes 7:0 and 7:05 becomes "7:5." I sort the
data numerically so 7:00 7:05 and 7:10 ends up looking and being
sorted like this:

7:0
7:10
7:5

and that makes 7:05 come after 7:10.

Also, the alarms are displayed in 24 hour time so you're out of luck
if you like 12 hour time. These could be fixed but I don't have the
time at the moment and would require a script instead of a command.

brandall

unread,
Jul 7, 2011, 2:48:27 PM7/7/11
to Tasker
Good work! Thanks for sharing.

Rob Dickson

unread,
May 12, 2012, 3:53:40 AM5/12/12
to tas...@googlegroups.com
Thanks for this. Root access shouldn't be needed to give the Next Alarm information, there are several apps that achieve this.

I'll try what you suggested when I have time, but I wondered whether Settings.System.NEXT_ALARM_FORMATTED would be easier.

http://stackoverflow.com/questions/8133788/time-to-the-next-alarm-in-seconds-or-milliseconds

Excuse my ignorance if I'm way off the mark.

Scott

unread,
May 15, 2012, 9:56:09 AM5/15/12
to Tasker
You guys might be interested in my alarm formatting task. I've
uploaded it with a description over at xda-developers
http://forum.xda-developers.com/showthread.php?p=26075708#post26075708
Reply all
Reply to author
Forward
0 new messages