Set alarm without duplicating

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
heilong
Posts: 77
Joined: 18 Oct 2016 15:20

Set alarm without duplicating

Post by heilong » 03 Dec 2018 10:32

I made a flow that adds a short-cut that adds an alarm (Set Alarm action) a couple of hours in the future, reminding me to do something.
I'd like those alarms to be single-use, disappearing after triggered once. Any idea how to do it?
Alternatively, every time I add a new alarm, it should replace the previous one (with the same label), rather than adding a new one.
Last choice would be to use a countdown timer (Set Timer action).

Appreciate any help :)

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

Re: Set alarm without duplicating

Post by Martin » 04 Dec 2018 20:47

Hi,

It's under the control of the alarm app how it will handle this and whether it will create a new alarm or remove an old alarm.
According to the specification an alarm clock should remove an alarm that was created by action Set Alarm when option Skip UI is set and the alarm has been dismissed.

Regards,
Martin

User avatar
heilong
Posts: 77
Joined: 18 Oct 2016 15:20

Re: Set alarm without duplicating

Post by heilong » 05 Dec 2018 20:45

Thanks Martin.
I'll play with this more and see if that is the case.

canadaDry
Posts: 33
Joined: 09 Feb 2018 18:38

Re: Set alarm without duplicating

Post by canadaDry » 06 Dec 2018 05:03

I'm looking into doing something similar for voice activated reminders... e.g. "Remind me in 2 hours to..."

I use "Alarm Clock Xtreme" https://play.google.com/store/apps/deta ... free&hl=en (note: I use the older V4.0.1 - newer versions reportedly have issues) as my goto alarm clock app. To get at the alarms I query its sqlite db using Automagic's execute-root-command/sqlite-select.

My rough approach is to use sqlite to either add or update an existing alarm.

User avatar
heilong
Posts: 77
Joined: 18 Oct 2016 15:20

Re: Set alarm without duplicating

Post by heilong » 06 Dec 2018 07:37

Does the alarm clock monitor the sqlite file for modifications?

Normally I'm using "Sleep as Android" but for this task I opted for the default Clock/Alarm app built into my ROM (CM13-based). Perhaps I will try Sleep as Android if that doesn't work well.

canadaDry
Posts: 33
Joined: 09 Feb 2018 18:38

Re: Set alarm without duplicating

Post by canadaDry » 07 Dec 2018 05:33

heilong wrote:Does the alarm clock monitor the sqlite file for modifications?

Just did a quick test using Automagic's set alarm and added it a new alarm via my default alarm app. Once the alarm has fired the alarm xtreme app disables the alarm - just as Martin noted.
Martin wrote:It's under the control of the alarm app... the specification should remove an alarm that was created by action Set Alarm when option Skip UI is set and the alarm has been dismissed.

So, it looks like I won't need to use sqlite to add the new alarm, but I'll still need to do further testing to see how the app behaves after deleting the alarm in the sqlite db (via automagic). Though, worse case is that the disabled alarms stick around until I manually clean them up.

schnipp
Posts: 2
Joined: 09 Jan 2019 17:10

Re: Set alarm without duplicating

Post by schnipp » 09 Jan 2019 22:05

Hello,
I'm new to Automagic and if I understand correctly are looking for the same or similar solution as the TO. (please let me know if I should better open a new topic)

So far I've been using NFC tags to start alarms in x minutes for different, regular tasks. Those start an alarm in x minutes which removes itself from the clock app on their own after they went off.

But I'm considering of getting a new phone and some of those (Xiaomi) don't have NFC tags.


For now I've created flows that add a shortcut with which I can start x minute timers. Works nice so far and it's a decent alternative to my NFC tags, but once I start a timer it seems there's no way to stop them (i.e. started the wrong one or accidentally started it).
Is there a way to not use 'Set Timer' and have it work with setting an alarm in X minutes, so I can cancel them if necessary?
I've looked into 'Set Alarm', but there I can only set a time of day for the alarm, not an alarm in X minutes from now.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Set alarm without duplicating

Post by Desmanto » 10 Jan 2019 06:21

I don't get exacty what you need. Maybe you should open a new thread instead. There are basically 3 ways to do it, you have mention 2 of them.

1. using action Set Timer, you can set X minutes from now. Usually there is notification from the clock app, where you can stop the timer. My RR 6.2.0 have the notif to stop the timer or to add a minute to it.
2. using action Set Alarm, you can still set X minutes from now. But you have to parse current time first. Set Alarm will always set the next alarm in the next 24 hours. So you can use getDate() to get current time, add X minutes and show it in HH and mm format to get the hour and minutes. Put the variable into Set Alarm
3. Using Trigger Global Variable Date/Time. Take current time, add X minute to it and set it to the Glovar DT. Then in another flow, use Trigger Glovar DT and use that glovar. Add action sound or any other notification method you want to indicate the time point has been reached.

If there is no way to stop current timer, you can create your own method to stop it. Use action notification on status bar, pair it with another flow with trigger Notification on statusbar selected. After you press that notif, you can remove the running timer/alarm. For Set Timer/Alarm, probably you should enable another flow to press the dismiss button when the timer/alarm is up. For Glovar method, it is easier, simply removeVariable() the glovar.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

schnipp
Posts: 2
Joined: 09 Jan 2019 17:10

Re: Set alarm without duplicating

Post by schnipp » 10 Jan 2019 09:55

My clock app for some reason doesn't allow me to cancel the timer, but I will try your method to cancel a running timer later.
Thanks for the help.

Post Reply