Blackberry ApplicationIndicator click handler on Home Screen

こ雲淡風輕ζ 提交于 2019-12-13 05:00:01

问题


I am creating an application which has a notification icon on the status bar of the BlackBerry home screen. I want to launch my app when this notification icon is clicked.

I am able to create a notification icon in the status bar with ApplicationIndicator, but I am not able to register a click handler to launch the application.


回答1:


In Blackberry OS 6.0 we have a new API which can be used for launching an app from the notification bar. Here is an example:

try {
    DemoMessage msg = new DemoMessage();
    ApplicationDescriptor daemonDescr = ApplicationDescriptor.currentApplicationDescriptor();
    ApplicationDescriptor mainDescr = new ApplicationDescriptor(daemonDescr, "MyAppName", new String[] {});

    // Get existing messages from storage and register them in folders
    ApplicationFolderIntegrationConfig inboxIntegration = new ApplicationFolderIntegrationConfig(true, true, mainDescr);

    ApplicationMessageFolder folder = ApplicationMessageFolderRegistry.getInstance().registerFolder(
        APPLICATION_ID, "MyApplictionFolderName", new ReadableListImpl(),inboxIntegration);
    folder.fireElementAdded(msg);
} catch (IllegalArgumentException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (NullPointerException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Where DemoMessage and ReadableListimpl are classes from Blackberry 6.0's MessageListDemo sample app.

For reference, see also this related question: Opening application from notification bar in blackberry.



来源:https://stackoverflow.com/questions/5044527/blackberry-applicationindicator-click-handler-on-home-screen

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