2011-02-18 91 views
0

我正在創建一個應用程序,它在BlackBerry主屏幕的狀態欄上有一個通知圖標。我想在點擊此通知圖標時啓動我的應用程序。主屏幕上的黑莓ApplicationIndicator點擊處理程序

我能夠使用ApplicationIndicator在狀態欄中創建通知圖標,但我無法註冊點擊處理程序來啓動應用程序。

回答

0

在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