The CommonsBlog

Disabled Notifications: Setting Survives Uninstall

Normally, when you uninstall and reinstall an app, everything reverts back to the state the app was in after the original installation.

This is not true with the “Show notifications” checkbox that controls whether Notification or Toast work on Android 4.1+ devices.

I stumbled upon this purely by accident. I was responding to a StackOverflow question about setAutoCancel(true) not working, and I wanted to just run my test app once to confirm it worked. I first fired it up on a 4.1 emulator, and it behaved fine, though I do not have a PDF viewer installed, and my sample works better when there is one (the notification, when tapped, opens a downloaded PDF file). So I ran it on my Galaxy Nexus… and it did not work.

The only obvious response I got was a cryptic warning in LogCat:

04-23 18:10:33.052: W/NotificationManager(20521): notify: id corrupted: sent 1337, got back 0

(where 1337 is the notification ID for this Notification)

After a quick search of teh Interwebs, I stumbled upon mention of somebody else having received this warning when they had “Show notifications” toggled off. I was fairly sure that wasn’t the case here, as my sample app had been uninstalled before I ran it, but I checked Settings anyway.

And “Show notifications” was unchecked.

(checking it, of course, fixed my problem)

Apparently, the last time I had run this sample on this device, I used it to test “Show notifications”, and I happened to leave that checkbox unchecked. However, since this setting was retained even after an uninstall, my newly-installed version was still blocking notifications.

Switching to view all entries in LogCat then showed the following error, on the next line:

04-23 18:10:33.052: E/NotificationService(930): Suppressing notification from package by user request.

However, since that comes from NotificationService, it will not show up in a LogCat filtering on application.

I am sure that many of you give advice to users with balky app installations to uninstall and reinstall. That can cure some ills, but blocked notifications is not one of them.

Need help with Android app development? AndGlobe lists dozens of support sites, in a range of languages!