Home > Tips and Tricks

Expand and Collapse Notifications on Android via ADB Commands

In this guide, we will show you the steps to expand and collapse notifications on your Android device via ADB Commands. One of my testing phones is always connected to my PC via a USB cable and some or other type of debugging tests are being carried out on that. Since I mostly work via CLI [Command Line Interface], I like to minimize my interaction with my device up to the maximum possible extent.

However, I usually get quite a lot of work-related notifications on that device. From Gmail to Slack, from Telegram to Teams, and everything in between, the constant flow of notifications means that I have to pick up my device, expand the notifications panel, and have a look at all the alerts that I have received till now. While some of them are indeed useful, a plethora of others are completely irrelevant.

But I don’t have any idea about the importance of these alerts and hence have to pick up my device every time a notification comes. This tends to break my workflow and causes a minor disruption as well. But not anymore. I stumbled upon a nifty workaround using which you can easily expand and collapse notifications on your Android device simply by executing a single line of ADB commands. In this guide, I will show you how to do just that. So without further ado, let’s check it out.

Expand and Collapse Notifications on Android via ADB Commands

YouTube video

  1. To begin with, download and extract the Android SDK Platform Tools on your PC.
  2. Then enable USB Debugging on your device and connect it to your PC via USB cable.
  3. After that, go to Settings > System > About Phone > Tap on Build Number 7 times.
  4. This will enable Developer Options. Go there and enable the toggle next to USB Debugging.retain twrp custom rom
  5. Now type in CMD in the platform-tools folder address bar and hit Enter.
  6. This will launch the Command Prompt. So type in the below command in the CMD window:
    adb shell "service call statusbar 1"

    expand notification android adb

  7. This will expand all the notifications [even the grouped ones!] on your device within seconds.
  8. You might get a prompt on your device if this is the first time executing the shell command. So tap OK/Allow/Grant if such a prompt appears.
  9. Finally, if you wish to collapse these notifications, then type in the below command in the CMD
    adb shell "service call statusbar 2"

    expand notification android adb

That’s it. These were the steps to expand and collapse notifications on your Android device via ADB Commands. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.


Share: