Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Posts: 43
Registered: ‎01-20-2009
My Device: Not Specified

Notifications Manager Cancel Notification bug

I am looking at the NotificationDemo from the 4.7.0 SDK. And I note that you have to use this one as the ones that come with 4.3.0 is buggy (dialog does not popup more than once).

So here are the steps.
- Grab the sample from 4.7.0 SDK.
- Comment out the Alert.startBuzzer and Alert.startAudio. (Basically disable Alerts stuff).
- Build it using 4.3.0 SDK. Run it using Bold Simulator.
- On the simulator, goto the sound profile and choose the new registered profile "Notification Demo" choose a tone that is fairly long. I used Notifier_Eurotrance.

The problem is the notification event sound. It won't stop when you click on "Ok" on the dialog using the navigation wheel and you will have the sound playing until it finishes.
If I use enter key instead, the sound will end. So it seems that programmatically cancelling notifications event will not stop the sound at all. However pressing hardware keys like space, enter, volume down, escape will also stop it, but not the navigation wheel click.

Is this a known issue with cancelDeferredEvent and cancelImmediateEvent will not stop the sound?


Posts: 43
Registered: ‎01-20-2009
My Device: Not Specified

Re: Notifications Manager Cancel Notification bug

In an effort to get more interest. Here is a very simple application to show the issue.

Remember to set the notification to a long tune after running the app.



package com.NotificationBug; import net.rim.device.api.notification.NotificationsConstants; import net.rim.device.api.notification.NotificationsManager; import net.rim.device.api.ui.MenuItem; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.container.MainScreen; public class NotificationBug extends UiApplication { public static final long NOTIFICATION_BUG_ID = 0xDC5bf2f34274ABCL; private Thread _thread; // thread that cancels the event after 1 second public static void main(String[] args) { new NotificationBug().enterEventDispatcher(); } public NotificationBug() { // registration of the source NotificationsManager.registerSource( NOTIFICATION_BUG_ID, new Object() { public String toString() { return "Notification Bug Event"; } } , NotificationsConstants.CRITICAL ); MainScreen screen = new MainScreen() { public boolean onClose() { return super.onClose(); } }; screen.setTitle("Notification Bug"); screen.addMenuItem(new MenuItem("Trigger", 10000, 10000) { public void run() { FireEvent(); } }); pushScreen(screen); } public void FireEvent() { System.out.println("Firing Event"); NotificationsManager.triggerImmediateEvent(NOTIFICATION_BUG_ID, 0, this, null); if ( _thread == null ) { // this create a thread that will start off sleeping for 1second and // then cancel event. _thread = new Thread() { public void run() { try { sleep(1000); } catch ( InterruptedException e ) { // TODO Auto-generated catch block e.printStackTrace(); } StopEvent(); _thread = null; super.run(); } }; _thread.start(); } } public void StopEvent() { System.out.println("Stopping Event"); NotificationsManager.cancelImmediateEvent(NOTIFICATION_BUG_ID, 0, this, null); } }




Posts: 37
Registered: ‎10-17-2008
My Device: Not Specified

Re: Notifications Manager Cancel Notification bug

I'm seeing the exact same issue.  My test platform is Bold 9000 running firmware

New Contributor
Posts: 2
Registered: ‎03-15-2010
My Device: 9500
My Carrier: Eclipse

Re: Notifications Manager Cancel Notification bug

Hi all, I need to call ID:2868625504212929965L,but the project runing,Setting Simulator  "Option"-->"Sounds and Ring Tones" can't open and quote some mistakes, pls help me,Thanks All.

Just do it...
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: Notifications Manager Cancel Notification bug

Any update on the issue?

The cancelImmediateEvent() really doesn't work.
But touching any hardware button stops it.

Any hints?

"Listen carefully, I shall say this only once"