在主屏幕黑莓ApplicationIndicator单击处理程序 [英] Blackberry ApplicationIndicator click handler on Home Screen
问题描述
我创建它具有黑莓手机的主屏幕的状态栏上的通知图标的应用程序。我要启动我的应用程序点击该通知图标时。
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.
我能够创造与ApplicationIndicator状态栏通知图标,但我无法注册一个点击处理程序来启动应用程序。
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.
推荐答案
在黑莓OS 6.0,我们有哪些可以用于从通知栏启动一个应用一个新的API。下面是一个例子:
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();
}
其中, DemoMessage
和 ReadableListimpl
类是黑莓6.0的 MessageListDemo
示例应用程序。
Where DemoMessage
and ReadableListimpl
are classes from Blackberry 6.0's MessageListDemo
sample app.
有关参考,也看到此相关的问题:<一href=\"http://stackoverflow.com/questions/7967126/opening-application-from-notification-bar-in-blackberry\">Opening应用在黑莓的通知栏。
For reference, see also this related question: Opening application from notification bar in blackberry.
这篇关于在主屏幕黑莓ApplicationIndicator单击处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!