Scroll down notification area on unlock, when notifications are present

15 views
Skip to first unread message

Ynk H

unread,
Apr 28, 2016, 8:08:01 AM4/28/16
to Tasker
Hi all, 

In a pre-fingerprint era, to unlock the phone, I needed to put the display on, and fill in the pattern/password.
In case I had a notification, I could easily select the notification on the lockscreen, perform an unlock and I was immediately in the application.

I'm now using a Nexus 5x with fingerpint, this means the phone goes to the homescreen after a fingerpint scan (without showing the notifications on the lockscreen, as it is bypassed).

Tasker Question : Is it possible to "After unlocking the phone, checking if a notification is present, if yes = scroll down the notification area".

Problem : I can't find how to check if a notification is present. Notification Listeners only react when a notification is received, which is not what I need.

Thanks for your help,
Yannick

Rich D

unread,
Apr 29, 2016, 11:30:38 PM4/29/16
to Tasker Google Groups Post

> Problem : I can't find how to check if a notification is present. Notification Listeners only react when a notification is received, which is not what I need.

You can get all the current notifications from the shell command: dumpsys notification

Root is required and you will have to parse out the relevant information. 

Ynk H

unread,
Apr 30, 2016, 4:38:37 PM4/30/16
to Tasker
Thanks a lot! It works now!

As I couldn't find an example, I'm posting what I created to help someone else.

Tasker always appears in the notification area, so I had to create a verification for 
Tasker to be the first in line -> Don't expand the status bar, 
OR another app has a notification, thus Tasker not first in line -> Expand the status bar.

A profile is created with event : Display Unlocked redirecting to the following task :

//create a variable with a return
1. Variable Set
Name: %ret
To: (fill in one return/enter)

//This dumps a lot of info concerning the notifications in the variable %Running
2. Run Shell
Command: dumpsys notification
Timeout: 0
User Root: Checked
Store Output in: %Running

//Split the text from variable %Running (set in point 2) at each break/return (set in point 1)
3. Variable Split
Name: %Running
Splitter: %ret

//If tasker doesn't appear in the 3rd line of the notification dump, it means another app has a notification
4. If: Running3 !~ *tasker*

//Expand the status bar
5. Status Bar
Set: Expanded

//End if
6. End if

At last... I hope there wasn't a much easier method :-) 


Op zaterdag 30 april 2016 05:30:38 UTC+2 schreef Rich D:
Reply all
Reply to author
Forward
0 new messages