【问题标题】:Blackberry ApplicationIndicator click handler on Home Screen主屏幕上的黑莓应用程序指示器单击处理程序
【发布时间】:2011-02-18 17:30:06
【问题描述】:

我正在创建一个应用程序,它在 BlackBerry 主屏幕的状态栏上有一个通知图标。我想在单击此通知图标时启动我的应用程序。

我可以使用 ApplicationIndicator 在状态栏中创建通知图标,但我无法注册点击处理程序来启动应用程序。

【问题讨论】:

    标签: blackberry notifications messages


    【解决方案1】:

    在 Blackberry OS 6.0 中,我们有一个新的 API,可用于从通知栏启动应用程序。这是一个例子:

    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();
    }
    

    其中DemoMessageReadableListimpl 是来自Blackberry 6.0 的MessageListDemo 示例应用程序的类。

    作为参考,另请参阅此相关问题:Opening application from notification bar in blackberry

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多