blackberrynotificationsmessage

Blackberry - open application on message notification click


My app sending messages notification to the home screen notification bar, but when I'm clicking on some message there, "Message Preview" window opens.

I am aware of
SO - Opening application from notification bar in blackberry
SO - Blackberry ApplicationIndicator click handler on Home Screen

While I have implemented ApplicationMessageFolderListener and adding it to ApplicationMessageFolder, still actionPerformed is never called when I'm clicking on message in notification bar.

Is there a way to handle notification message click event from own application?

Same question on BB forums.


Solution

  • I recently struggled with this very same problem. When a user opens an ApplicationMessage object, ApplicationMessageFolderListener.actionPerformed() is not notified. It is notified if the user marks the message as opened without actually opening it. After some digging, this is by design.

    To get notified when the message is actually opened, you have to implement a class that extends the ApplicationMenuItem class and overrides its run() method. The context parameter will be set to the ApplicationMessage object that is being opened. You can then register that menu item using the ApplicationMessageFolderRegistry.registerMessageMenuItems() method for the particular message state combinations that the menu item applies to, such as ApplicationMessage.Status.UNOPENED.