Is it possible to detect when opening notification tray?
Triggers App task started/ended react when opening and closing notif.tray if set to current foreground app, but I have yet to find a way to detect the tray itself.
Triggers Activity started/ended won't have any reaction.
Detect notification tray
Moderator: Martin
Re: Detect notification tray
You could try trigger UI Event with event Window opened, package com.android.systemui and contains text Notification shade.
The trigger might need different settings on your device so you might have to leave contains text empty and use an action Write to Log {text} to see if the text is a different one on your device. I've just tested on a Nexus 5X with Android 7 so it might not work at all on different versions of Android or other ROMs.
The trigger might need different settings on your device so you might have to leave contains text empty and use an action Write to Log {text} to see if the text is a different one on your device. I've just tested on a Nexus 5X with Android 7 so it might not work at all on different versions of Android or other ROMs.
Re: Detect notification tray
Thank you, it works.
That trigger didn't occur to me because on my previous phone(KK) the notification tray didn't "interfere" with App Task triggers. Things has changed on Marshmellow.
That trigger didn't occur to me because on my previous phone(KK) the notification tray didn't "interfere" with App Task triggers. Things has changed on Marshmellow.
Re: Detect notification tray
One more question. Is it possible to detect this with a condition? With the trigger I can't make reliable solution for the interfering I mentioned because most of the time App task ended fires before Ui event.
Or I could use trigger Activity started:*/*, excluding only the desired app but that would be triggering all the time I do something with my phone. Thus I'd prefer trigger App task ended.
Or I could use trigger Activity started:*/*, excluding only the desired app but that would be triggering all the time I do something with my phone. Thus I'd prefer trigger App task ended.
Re: Detect notification tray
A condition is tricky. A condition App Task Running: com.android.systemui could work but also includes other things like recent tasks and probably a few other screens.
Maybe you could add a short delay (e.g. 100ms) to the flow that is triggered by App task ended to ensure that the UI event is handled first.
Maybe you could add a short delay (e.g. 100ms) to the flow that is triggered by App task ended to ensure that the UI event is handled first.
Re: Detect notification tray
This solution seems to work quite reliably. Indeed it needs a short sleep action or the condition does not catch the system ui task.