How to remove the annoying “Backup Battery Very Low” (bogus) critical notification programmatically.

Introduction

The following code snippet demonstrates a way to programmatically remove "backup battery very low" system notification message-balloon from the system and its icon from the navigation bar of the Windows Mobile device screen. Why this is useful and what problem it solves is being discussed in the next section – “Background”.

Background

Whenever the backup-battery of a device becomes very low, the Windows Mobile based Pocket PC devices would pop up a critical system notification balloon with an icon in the navigation bar to notify the user that the system backup battery is running critically low. This is indeed a critical device condition, and the user is expected to take swift action to replace/recharge the backup battery accordingly to avoid potential data loss.

However, some of the devices that are in the current market either do not have a way to get to where the backup battery is located so that it can be replaced, or for some, even if the battery is replaced, the message-balloon pops up every so often when they cycle the device power, for example. In the latter case, it is a bogus condition, which is annoying to many.

Although, this notification goes away once the user acknowledges the pop up notification, the situation is quite different for applications that are running as Kiosks (full screen mode). In this case, the notification message-balloon never pops up, but the icon is being displayed in the navigation bar, and there is no way to get rid of it.

I found a simple workaround for the above-mentioned situation. You may use the workaround as it fits.

Using the code

The logic behind the workaround is quite simple. There are a couple of tricks involved, though. The logic is to enumerate through the system notifications and find the handle to the "backup-battery very low" notification, and if one is found, remove the notification from the system programmatically.

First of all, be cautious to have a mechanism in place to distinguish the difference between the bogus situation that this notification pops up and the actual condition that the user should take appropriate action to prevent potential data loss.

Second of all, you may need a way to obtain the CLSID for the notification’s COM interface from its text form. You may use CLSIDFromString() function as shown in the code snippet. This function has been implemented in ole32.lib and oleaut32.lib libraries. You may want to #include objbase.h header in your project as well.

Furthermore, the SHNotificationGetData() function call requires a unique notification ID to be passed into the function, which we do not possess. Different platform vendors have assigned different IDs to this same notification making it harder to guess. So, in my workaround, I try different IDs starting from 0 and incrementing by 1 sequentially upon each failed call. In all the platforms that I have tried, there could be a matching ID found within less than 2000 attempts. You may want to experiment for the platforms that you develop first, just to get an idea. It would be nice if your platform vendor can provide you this ID value. If not, you can still use the method that I use.

I have successfully utilized this method in eVC++ 3.0 and 4.0 projects with Windows Mobile 2002/2003/2003SE devices from several vendors.

Points of Interest

It was great fun for me to think this through. This bogus message has given us a huge annoyance for quite a long time until I came up with this idea to get it removed programmatically. There is nothing magical in this logic. Also, this same approach can be used to remove any of the system notifications that you might not want. Be careful, though!

History

August 30th, 2005 – Initial posting to The Code Project.

License

Share

About the Author

I work as a Software Design Engineer for Electrical Design Engineering (R&D) at Cyberonics, Inc., Houston Texas, USA. I have been working in a project that involves programming for Windows Mobile based Pocket PC devices. I enjoy chalenges of software engineering, and resolve them, as well as share the solution(s) with fellow developers. In my spare time, I enjoy thinking, surfing web, and play with my daughter. I spend my weekends working in house-cleaning and lawn moving activities.

Comments and Discussions

Hi Channa, using this method would allow me to loop over all the notifications displayed? (reminders, alarms, missed calls, etc) and read them?
What I would like to do is get all of them and extract their content to display them in a form. Would that be possible?

I seen your article, it's very nice.
I have one problem.
I want to do the same but for notification about "Receiving Data", when the file send via bluetooth.
Is their any way to do this?
Which CLSID will be required for that?
Please help me.

But I can't find the CLSID you mentioned. I've use the tool to check the registry. I've seen a lot of information in the CLSID section. However, I don't know which one is the one I want. Can you give me some advice?

Besides, is it possible to create an new notification on the notification bar use the similar way you described?

I am very interressing by your article.
I would like to do the same think but with the incomming call phone balloon .
Did you know how to remove the notification balloon from incomming call on pocket phone (2003 )
Where do you found CLSID mapping ?

You may check the machine registry for the CLSID that you've mentioned. Specifically, HKEY_CLASS_ROOT\CLSID section. Please make sure you do not de-stabilize your phone in the process of doing what you are describing here! Good luck.

since it is a mobile device and space is limited, you can just edit the registry with the same clsid and turn off the notification.
Otherwise you will need to have this code in a application running or create another Today item hookin that will automatically call the code on startup.