0

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.

Maksym Gontar
  • 22,765
  • 10
  • 78
  • 114
Prem
  • 4,823
  • 4
  • 31
  • 63

1 Answers1

0

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.

Community
  • 1
  • 1
cherry
  • 194
  • 2
  • 2
  • 11