Blackberry - open application on mesage notification click

痴心易碎 提交于 2019-12-06 12:52:38

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/8536271/blackberry-open-application-on-mesage-notification-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!