主屏幕上的黑莓ApplicationIndicator点击处理程序

问题描述:

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

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

在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从黑莓6.0的MessageListDemo示例应用程序类。

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