Limiting repeating notifications

Post your questions and help other users.

Moderator: Martin

Post Reply
Varaloba
Posts: 6
Joined: 14 Mar 2019 10:38

Limiting repeating notifications

Post by Varaloba » 16 Mar 2019 11:34

Having just joined the forum, I am learning quickly about Automagic.

I have manages to set up a repeating (sound) notification for WhatsApp, as below, which can be the basis for other notification apps.

But what I want to do, is to limit the number of repetitions before stopping (instead of continuously repeating until opened), so for example I could choose, 2 or 3 or 10 etc.

Have looked on the forum, but so far have not found the answer, so hoping someone will help.

Flow 1 : Trigger Notification on Statusbar Displayed, select WhatsApp. Action only one, enable flow 3

Flow 2 : Trigger Notification on Statusbar Removed, same package name as flow 1. Condition Notification on Statusbar Displayed (similar to trigger but this one check for state, not event), same package name. False : flow pattern list, disable flow 3.


Flow 3 : Periodic Timer, 5 Minute (or whatever). Action sound. Note: ticked “like alarm clock”

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

Re: Limiting repeating notifications

Post by Desmanto » 16 Mar 2019 13:30

At flow 3, add condition execution count, 3, after the action sound. True, branch to action set flow state, flow 3 - disable. This mean, after 3 executions, the periodic timer flow automatically disable itself.
Make sure you uncheck the default name at the Execution count. As the value persist for the same condition name. Change the default name to something else, example Execution Count: 3 times notif
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.

Varaloba
Posts: 6
Joined: 14 Mar 2019 10:38

Re: Limiting repeating notifications

Post by Varaloba » 17 Mar 2019 07:41

Thank you for that excellent reply, very much appreciated.

One other question I would like to ask ….

In addition to WhatsApp, I would like to add other notification apps, but with different notification sounds and times.

Of course Flow 3 will be different for each, but is it possible to incorporate these into Flows 1 & 2, or is it better to have a new set for each one.

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

Re: Limiting repeating notifications

Post by Desmanto » 17 Mar 2019 12:50

You can use multiple app notification in flow 1 and 2. Just add them to the notification trigger, tick all the apps you need. But for the timer (flow 3), since it is possible to have multiple running instance (example, you have whatsapp, calendar, colornote notification at the same time), you should make as many flows copy as the apps you need. So maybe you have flow 3 copies as : "Whatsapp Reminder", "Calendar Reminder", "ColorNote Reminder". All these flows have its own timer, different sound, different execution count.

At flow 1 and flow 2, you can add script, create a map object to separate the trigger app.

Code: Select all

db = newMapFromValues(
"Whatsapp", "Whatsapp Reminder",
"Calendar", "Calendar Reminder",
"ColorNote", "ColorNote Reminder" );
Later at the set flow state, use {db[app_name]} in the flow field. If the notification comes from calendar, then passing the value to the map, you will get "Calendar Reminder" in the set flow state.
Add the map entry and flow 3 copy as many as you need.

Pro Tip : You can combine flow 1 and 2 by using both triggers in the flow, and split the trigger by using multiple parallel expression. You can look at the example on how I split the trigger at my flow sharings, i.e : viewtopic.php?f=3&t=7858
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.

Varaloba
Posts: 6
Joined: 14 Mar 2019 10:38

Re: Limiting repeating notifications

Post by Varaloba » 17 Mar 2019 13:41

Hi Desmanto

As a new user, it is great to have someone of your experience to help out and guide, as there is clearly a lot to learn - I will digest your latest post and implement - thanks again

Varaloba
Posts: 6
Joined: 14 Mar 2019 10:38

Re: Limiting repeating notifications

Post by Varaloba » 18 Mar 2019 14:06

I have tried to implement what you said, but the notification sounds for the two apps are merging, set up Whatsapp with one sound and Bluemail with another, perhaps you could check out the flows to see if they are correct ....

Flow 1:
Notification on statusbar displayed, package names: me.bluemail.mail,com.whatsapp LINKED TO ..

Script
db = newMapFromValues(
"Whatsapp", "WhatsappReminder",
"Bluemail", "BluemailReminder",
"ColorNote", "ColorNote Reminder" ); LINKED TO ..

Set flow state, enable, flow pattern list: WhatsappReminder,BluemailReminder

Flow 2:
Notification on statusbar removed, package names: me.bluemail.mail,com.whatsapp LINKED TO ..

Script
db = newMapFromValues(
"Whatsapp", "WhatsappReminder",
"Bluemail", "BluemailReminder",
"ColorNote", "ColorNote Reminder" ); LINKED TO ..

Notification on statusbar displayed, package names: me,bluemail.mail,com.whatsapp LINKED TO ..

Set flow state, disable, flow pattern list: WhatsappReminder,BluemailReminder

Whatsapp or Bluemail reminders ..

Periodic timer, every xx seconds, LINKED TO ..

Time range, between 08.00 and 22.00, LINKED TO ..

Sound (notification sound), LINKED TO ..

Execution count, x times, LINKED TO ..

Set flow state, disable, flow pattern list - either WhatsappReminder or BluemailReminder

Many thanks in advance

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

Re: Limiting repeating notifications

Post by Desmanto » 20 Mar 2019 15:29

All your Set Flow State use the incorrect value, it enable every flow reminder at once. You can check this by looking at the flow state of all reminder after any of the notification arrived.

Flow pattern list in flow 1 and 2 should be : {db[app_name]}

While in the flow 3 copies, it should disable only itself. So WhatsappReminder flow only disable WhatsappReminder, and BluemailReminder only disable BluemailReminder
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.

Post Reply