Page 1 of 1

Condition for disabled alarm.

Posted: 30 Aug 2014 08:55
by skahlhoefer
Hey folks,

I have a flow which gets executed after I confirmed the alarm to snooze for 10 minutes or to get completely switched off.
This is realized by a broadcast of com.android.deskclock.ALARM_DONE.
What I originally wanted to do is to react only when I confirm the alarm, not when I snooze it.
Unfortunately I tried to achieve this by using the alternative broadcasts com.android.deskclock.ALARM_DISMISS as well as com.android.deskclock.ALARM_SNOOZE which both didn't work.

Any ideas in how to do this?
My phone is a Google Nexus 5.

Thanks in advance!
Stefan

Re: Condition for disabled alarm.

Posted: 30 Aug 2014 09:27
by Martin
Hi,

It seems that the Clock app sends the broadcast com.android.deskclock.ALARM_DONE for both dismiss and snooze cases. Unfortunately the intent does not contain a flag to distinguish the two cases.
You could either react to the notification that's displayed when the alarm is snoozed (for example using condition Notification on Statusbar displayed and check whether one of the text variables contains the word Snooze).
Another option would be to use a trigger UI Event: Announcement package com.google.android.deskclock with contains text Dismiss respectively contains text Snooze.

Judging from the source of the alarm app the two broadcasts com.android.deskclock.ALARM_DISMISS and com.android.deskclock.ALARM_SNOOZE are meant to be used by other apps to dismiss/snooze the alarm but not to react to the event.

Regards,
Martin

Re: Condition for disabled alarm.

Posted: 30 Aug 2014 20:34
by skahlhoefer
Thanks for this hint, Martin. A condition to check for notifications from deskclock solved my problem as no notification is displayed after switching off the alarm.