Condition for disabled alarm.

Post your questions and help other users.

Moderator: Martin

Post Reply
skahlhoefer
Posts: 12
Joined: 02 Dec 2013 22:35

Condition for disabled alarm.

Post by skahlhoefer » 30 Aug 2014 08:55

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

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Condition for disabled alarm.

Post by Martin » 30 Aug 2014 09:27

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

skahlhoefer
Posts: 12
Joined: 02 Dec 2013 22:35

Re: Condition for disabled alarm.

Post by skahlhoefer » 30 Aug 2014 20:34

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.

Post Reply