Struggling with Autonotifcaton filling fields

32 views
Skip to first unread message

Michael Wayne

unread,
Jan 13, 2022, 12:00:18 PM (4 days ago) Jan 13
to Tasker
Goal is to process incoming Gmail messages and take different actions depending on sender, recipient (I forward a lot of email to this account), etc. I'm having a few issues, possibly due to changes over time which invalidate some reference posts I found with Google.

  1. I can not find a variable containing the email recipient. %anpeople  seems to only contain the email address of the sender.
  2. My Profile is AutoNotification Intercept (Event, Only Created Notifications, Non-Persistent Only, Has Reply Action: true, Notification Apps: Gmail).  To debug, I flash %anpeople, %antext and %antitle first thing in the Task. If all my email has been read, I seem to get the correct information. But, after the first email has come in, the second+ email pulls the information from the first unread mail/notification. I'm guessing that I'm seeing a persistent notification instead of the new one but with "Only Created", I don't think I should be?

Michael Wayne

unread,
Jan 13, 2022, 4:17:24 PM (4 days ago) Jan 13
to Tasker
I enabled logging and did some tests. It is definitely the case that a new notification is pulling all old data from the oldest notification remaining on the phone. The phone is a Pixel 6 Pro running Android 12. Clearing the old notification permits the new information to come through, regardless of whether the email has actually been read or not. 

RSF

unread,
Jan 14, 2022, 10:57:32 AM (3 days ago) Jan 14
to Tasker
Regarding question #2: AutoNotification pulls all notifications that match its parameters, and puts them in an array. If you only have one notification, then referring to e.g. %antitle will give you that 1st title, but when there are multiple notifications, you need to access the array with an index, i.e. %antitle(%notif_index) to get at those additional entries.

You can use a "for" loop something like
    FOR %notif_index from 1:%antitle(#)
        (actions here should use %antitle(%notif_index), %antext(%notif_index), etc.
    END FOR

Michael Wayne

unread,
Jan 14, 2022, 2:07:22 PM (3 days ago) Jan 14
to Tasker
Sorry, I should have posted that I tried that already.  %anpeople, %antext and %antitle are never arrays, they are single variables. in all cases (#) returns size 0. Looks like a bug in autonotification.

Brenden M

unread,
Jan 14, 2022, 3:16:58 PM (3 days ago) Jan 14
to Tasker
I am using a Pixel 6 Pro, running on November security patch still, there are countless bugs, across the gamut, for many many users, Google halted the update due to acknowledged bugs.

I totally recommend getting an update or two, to see if these issues are resolved after that. It might not be an AutoNotification bug solely but an interaction perhaps with one of the many many bugs on P6P.

Just a random thought... Good luck solving it soon.

RSF

unread,
Jan 14, 2022, 5:58:10 PM (3 days ago) Jan 14
to Tasker
I should've read your post more carefully. I see now you're using an AutoNotification Event (not Action). In that case, yes, you'll only get a single title, text, person, etc., since each individual notification triggers a separate event; each event only covers a single notification.

Is your Task configured to allow multiple occurrences to execute at the same time? The default task setup is to abort new tasks with the same name, if an existing one is still running. That would result in your only getting the first notification if they come in rapidly enough. You'll want your task configuration to say "Run both together", not "Abort new task". Access that via the gear icon at the top right of the screen, when inside a task (i.e., where the task actions are listed). See if that helps.

Michael Wayne

unread,
Jan 14, 2022, 8:27:38 PM (3 days ago) Jan 14
to Tasker
I enabled "Run Both Together" thanks. But, as expected, it does not help. Situation:
  1. gmail comes in. It takes my Pixel some time (3-5 minutes after I see it on my desktop) to realize that new mail has come in but, eventually, it does notice at which point  the notification is displayed and Autonotification Event invokes the associated task which does all the "right things" completing successfully. But I'm busy and I saw that it's not important so I don't touch my phone.
  2. Some time later (like, maybe an hour), another gmail comes in. Once again, the task gets invoked but it gets the information from the first gmail notification from an hour ago.
  3. Any additional email does exactly the same thing until the original notification is cleared on the phone, at which point the next gmail will work correctly.

RSF

unread,
Jan 14, 2022, 9:06:52 PM (3 days ago) Jan 14
to Tasker
Oh. If step #2 occurs an hour later, then changing to "Run Both Together" won't help, as you saw.
I

RSF

unread,
Jan 14, 2022, 9:12:02 PM (3 days ago) Jan 14
to Tasker
AutoNotification events work correctly in this scenario on my phone (%antitle etc. match the subsequent notifications...), so I'm not sure what else you can try. It may be an issue with Pixel & AutoNotification(?)

You might try using Tasker's native Notification event, which populates its evtprm() array with title, text, & app. Maybe that'll (a) work correctly and (b) have enough data (although it is far more limited than AutoNotification). Or, maybe, a combination, meaning, using the Tasker notification event, get its title, then call the AutoNotification Query action to get the rest of the notification's data?

Michael Wayne

unread,
Jan 17, 2022, 3:00:47 PM (19 hours ago) Jan 17
to Tasker
Just got the January update, did not change this behavior. Looks like Autonotification is checking the wrong end of the Gmail notification list.  If another Pixel 6 Pro owner could confirm this behavior, perhaps we could get João to take a look at it. If it's just me, then I have managed to set something bad.

It's specific to Gmail, I have a similar handlers for text messages and they work correctly.

Update: I found a work around!
Autontoification->Notification Interception->Delay Apps' Notification and select Gmail.

joaomgcd

unread,
9:21 AM (21 minutes ago) 9:21 AM
to Tasker
That usually happens when apps post multiple notifications at the same time and your task's Collision Handling is not set to "Run Both Together".

The simplest way to go around it is probably the way you did it :)

Reply all
Reply to author
Forward
0 new messages