Calendar event trigger - multiple events

Post your questions and help other users.

Moderator: Martin

Post Reply
vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Calendar event trigger - multiple events

Post by vertigo » 05 May 2020 05:24

I'm trying to use Automagic to replace an app called Calendar Notifications, since that app doesn't quite work right and development is discontinued. It shows a notification at a user-set time ahead of calendar events to show the upcoming event and allow the notification to be snoozed or dismissed. Unfortunately, I didn't get very far at all before running into a problem: if there are multiple events that start at the same time (e.g. two all-day events in the same day, birthdays in my test), only the first one causes the flow to trigger and is displayed in a notification. Subsequent events are simply ignored (or not even registered). Each one should cause a trigger and, in the case of the flow I'm making, receive their own notification.

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

Re: Calendar event trigger - multiple events

Post by Desmanto » 05 May 2020 12:25

How do you the Calendar Event Trigger? Do you leave it blank so all event can match? And the notification is produced by "Calendar Notifications" app or by Automagic? If it is by Automagic, when two even occured, maybe you should loop the notification and create a new notif ID for each.

I almost never use calendar event. But AFAIK most built-in calendar app or calendar from google should be able to set those kind of reminder.
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.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Calendar event trigger - multiple events

Post by vertigo » 05 May 2020 18:42

Yes, blank. I'm having Automagic be triggered by an event and display a notification. The problems with looping are a) how to know when there are more than one event and therefore that it's needed, and b) it seems likely it would just keep seeing the first event only.

I've tried multiple calendar apps and none really do a great job with notifications. They are all pretty minimal, lacking useful features. Most simply provide a notification without the ability to snooze, those that do aren't very configurable, if at all, for the snooze options, and some/most don't handle events that were created without a reminder. After years of waiting for one of these apps to improve what you'd think would be a very important part of their app, and using two or three different apps built specifically for the purpose which have all gone defunct, I've finally had enough and decided to take it into my own hands. Automagic seems like a good option for doing it, and it seems it should be able to do everything I need, albeit a bit inelegantly, I just can't get past this first step.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Calendar event trigger - multiple events

Post by Rafi4 » 05 May 2020 22:55

Hi vertigo
In query Content Provider action change result type to table (transposed) or table.
Use condition debug dialog and you can see your all multiple events in a list. (In condition debug dialog action)

from record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Calendar event trigger - multiple events

Post by vertigo » 05 May 2020 23:05

Not sure if I fully understood, but I have the calender event trigger followed by query content provider action (tried both table and table (transposed), variable = result, everything else blank) then debug dialog condition. The dialog shows the first calendar event, but not the second. The second event is just not being seen by Automagic AFAICT.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Calendar event trigger - multiple events

Post by Rafi4 » 06 May 2020 02:19

Hi vertigo
This flow is working fine for me.

from record4
Attachments
flow_Events_notify_copy_075559.xml
Multiple events
(10.66 KiB) Downloaded 778 times
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Calendar event trigger - multiple events

Post by vertigo » 06 May 2020 07:24

Thanks. Unfortunately, most of that is beyond my understanding, and it doesn't seem to do anything. The isEmpty(query_list) condition returns true every time, so nothing happens. I'm not sure if I'm supposed to change anything to match my setup. I tried changing query content provider selection arguments to "Birthdays" but that didn't help.

I also see there's an action to create a calendar event, and I have no idea what its purpose is, but I'm not trying to add anything to the calendar, only notify of events already on it.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Calendar event trigger - multiple events

Post by Rafi4 » 06 May 2020 12:23

Hi vertigo
Are you using separate calendar app or device calendar app? If you are using separate calendar app you need to use action notification on Statusbar displayed. If you are any confusion use condition debug dialog. Manually execute the flow and check in condition debug dialog.
Condition debug dialog is most effective and very helpful in Automagic automation app. And remove action in the example flow create calendar event. Keep selection argument as in the flow.

from record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

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

Re: Calendar event trigger - multiple events

Post by Desmanto » 07 May 2020 15:46

@vertigo : I just tried with 2 events with the same starting time. Yes, only the first one created will trigger the flow. The second event doesn't appear. So calendar event alone won't work when you have multiple events. (I don't know if this can be considered as bug, as we expect to all events that happen even they have the same start time)

You have to use Query content provider as shown in Rafi4's flow. At the first query content provider, uncheck Selection and remove Selection Arguments. That is the filter. Break the link to the expression afterward and replace it with debug dialog, you can see the query_list content to check available calendar events. I can see my test 1 and test 2 events here. If you can't, try to create 2 new calendar events in the next 10 minutes, and check if both appear here.

Then after you get multiple calendars event, you can loop create multiple notification with increasing notif id. We don't know how many will be, so just create a loop. If the event is only one, then the loop stop right away after 1 notif. If they have 10, then it will create 10 notifs.

So the overall flow become
Trigger : Calendar Event
Action : Query Content Provider
Actions : loop create notification on statusbar.
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.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Calendar event trigger - multiple events

Post by Rafi4 » 07 May 2020 23:29

Hi Desmanto
If result type changed to table (transposed). We can get all events. I am already using this method. Working fine.

from record4
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

Post Reply