Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is There an adb/shell command to list the items on the android's notification bar?

Can someone tell me if there is a way to get the complete list of items currently being displayed in the notification bar? I'm trying to write an interface that will trigger notifications to my PC based on the particular app giving the notification.

My only hits for something similar using the adb cli tool is Receiving push notifications using adb shell command which appears to be trying to get the notification from a particular app.

Other references that I am finding are related to actual android programming and sending your own notifications to the bar.


For the sake of formatting, I'm repeating my comment to fRoStBiT who provided the resource in his answer. The following cli provides the specific item:

$ adb shell dumpsys notification | egrep NotificationRecord | awk -F\| '{print $2}'
like image 424
L. D. James Avatar asked Jul 12 '16 18:07

L. D. James


People also ask

How do I list devices on adb?

On Android 5.0, go to Settings -> Storage -> menu -> USB computer connection and make sure 'Media device (MTP)' is disabled. When it's disabled 'adb devices' lists the device, when enabled not.

How do I view files in adb shell?

Open cmd type adb shell then press enter. Type ls to view files list. At the DOS prompt, adb shell ls -R > junk lists all files and puts results into file junk which you can then edit via Notepad or whatever and see more than you'd want to, but your files, too!


3 Answers

You can use

adb shell dumpsys notification

It shows detailed information about currently displayed notifications.

like image 198
Vladimir Petrakovich Avatar answered Oct 16 '22 17:10

Vladimir Petrakovich


On Android >= 6 for get notification extras use this command

adb shell dumpsys notification --noredact

the full notifications text you can see at the extras section:


      extras={
          android.title=String (Bring The Rain)
          android.reduced.images=Boolean (true)
          android.subText=null
          android.template=String (android.app.Notification$MediaStyle)
          toSingleLine=Boolean (false)
          android.text=String (Upon A Burning Body)
          android.appInfo=ApplicationInfo (ApplicationInfo{c8165e6 org.telegram.messenger})
          android.showWhen=Boolean (false)
          android.largeIcon=Icon (Icon(typ=BITMAP size=100x100))
          android.mediaSession=Token (android.media.session.MediaSession$Token@608a746)
          gameDndOn=Boolean (false)
          android.compactActions=int[] (3)
            [0] 0
            [1] 1
            [2] 2
      }
like image 7
Andrey Izman Avatar answered Oct 16 '22 17:10

Andrey Izman


adb shell dumpsys notification | grep ticker | cut -d= -f2

shows me a little description of the texts of the screen. tickerText appears to be the name of the property which contains the text of the notifications

like image 5
Andres Avatar answered Oct 16 '22 18:10

Andres