A few years ago Android switched from a ticker style notification system to heads up notifications. Instead of just having the information scrolling across the status bar when a notification came in (ticker), heads up notifications in Android 5.0 Lollipop would popup on top of the status bar over any screen. Some people like this style as it allows you to quickly see and respond to important messages, but others hate when it interrupts what you’re doing such as gaming or watching a video. Here’s a tutorial on how to automatically block heads up notifications in whatever app you choose.
Currently, some users on custom ROMs are able to customize notification preferences for individual applications. Such a feature is coming to all users (…eventually) with the release of Android O and its notification channels, but while said feature allows you to disable heads up notifications for certain applications, there’s no way to specify that you don’t want to be interrupted when playing a game or watching a video. You can either permanently disable the app from displaying interrupting heads up notifications, or deal with them existing.
But thanks to the power of Tasker and a plugin called SecureTask, we can globally disable or block heads up notifications at any time we want such as when gaming or video watching. Now you can game or watch videos on Android without being interrupted by annoying drop down notifications ever again!
Block Heads Up Notifications – Tutorial
- Install USB drivers for your particular device OEM (Google provides a list of some universal USB drivers here). Likely only necessary for users on Windows.
- Download the ADB binary for your particular operating system (Windows, Mac, Linux).
- Extract the contents of the ZIP file above into an easily accessible folder on your PC (like Downloads).
- Go to the Settings app on your phone and tap on the About Phone option. Depending on the OEM, this may be in a separate tab. When in doubt, just use the search feature in Settings to find it.
- Find the “Build Number” value in About Phone and tap on it 7 times to enable Developer Mode.
- Go back to the Settings main menu and enter Developer Options so you can enable USB Debugging Mode. Find it and enable it.
- Plug your phone into the computer and change it from “charge only” mode to “file transfer (MTP)” mode. This is not always necessary but it may be required on your device, but there’s no harm in doing this step.
- Go back to the PC and navigate to the directory where you extracted the ADB binary from before.
- Launch a Command Prompt/Terminal in this ADB directory. For Windows users, you can easily do this by holding Shift and then Right-clicking then choosing the “open command prompt here” option.
- Once in the Command Prompt/Terminal environment, enter the following command:
- This will start the ADB daemon. If this is your first time running ADB, you will also see a prompt you to authorize a connection with the computer. Allow it.
- Now re-run the adb devices command from step 10, and you’ll see the serial number of your device in the output. If so, then you’re ready to move on. If not, then the USB drivers need to be re-installed.
- Launch the Settings application and go to the Accessibility Services page, then grant Tasker Accessibility permissions. You need to do this so Tasker can monitor when the game or media app you’re using is active.
- Launch SecureTask, accept the license agreement, and grant the requested permissions.
- Execute the following command in the command prompt or terminal:
- Then execute the following command to allow SecureTask to work properly here:
pm grant com.balda.securetask android.permission.WRITE_SECURE_SETTINGS
- Launch the Tasker application.
- In the Profile tab, tap the plus (+) icon
- Tap on the Application option
- Select the media/video applications or games you want to hide annoying notifications for. Tap the back button once you’re done.
- Tap New Task and give it a name (such as ‘block heads up notifications’)
- Tap the check mark to confirm the name choice
- Tap the plus icon (+) at the bottom of the screen when in the Task editing screen.
- Tap the Plugin –> Secure Task –> Secure Settings.
- Tap the pencil icon next to the word Configuration.
- Change the Action option from Read to Write. Put the following in as the Setting text:
global heads_up_notifications_enabled. And put the following in as the Value: 0. Tap done in the top right, then go back to Tasker’s main screen.
- Long press the new Task we just created, then tap on the Add Exit Task option.
- Repeat steps 23-26 but change the Value for
global heads_up_notifications_enabledin SecureTask from 0 to 1.
Okay, so what we have done here is created a Tasker profile where the application is looking to see if you ever launch an application or game (any applications or games that you selected in step 20). In my screenshots, I just selected Chrome and the Clock applications as an example. If you choose a game though, then Tasker will keep an eye out for anytime you have launched that particular game (or games). When Tasker sees you have launched any applications selected, it will kick in the task that we just setup and block heads up notifications globally.
So this task is simply executing a couple of commands on our devices. Since we have tied it to the application/game, the first command we typed in will only be executed when that game or application gets launched. It’s this command “global heads_up_notifications_enabled” with the value of 0 that actually disables heads up notifications entirely. So you could actually execute this in an ADB shell and completely turn off heads up notifications all the time, if that’s what you want.
This isn’t something that most people want though, as they actually just want to prevent those invasive notifications when they’re in the middle of a gaming or video watching session. So we’re executing this command with the value of 0 when we enter an application or game that we don’t want to be disturbed during, and the exit task will execute the same command but with a value of 1 to re-enable heads up notifications when we exit the game or video app.
Thus, this setup allows us to block heads up notifications when we launch any application of our choosing such as a game or video, and then enables it again when we exit that game or video app. Very simple to setup, but useful to have if you are in the zone when playing a game or just don’t want to be bothered when watching that movie or TV show.