Push notification 从主函数中注册两个应用程序
我正在开发一个应用程序,其中我必须从主函数注册两个侦听器。其中一个用于注册推送通知,另一个用于通知发出时,将在通知栏上显示图标,单击该图标我必须启动应用程序。 我做了一些错误的代码,但不知道在哪里请帮助我Push notification 从主函数中注册两个应用程序,push-notification,blackberry,Push Notification,Blackberry,我正在开发一个应用程序,其中我必须从主函数注册两个侦听器。其中一个用于注册推送通知,另一个用于通知发出时,将在通知栏上显示图标,单击该图标我必须启动应用程序。 我做了一些错误的代码,但不知道在哪里请帮助我 public static void main(String[] args) { // Create a new instance of the application and make the currently // running thread the applicati
public static void main(String[] args)
{
// Create a new instance of the application and make the currently
// running thread the application's event dispatch thread.
//System.out.println("====main function===="+args[0]);
System.out.println("====args.length==="+args.length);
if(args.length > 0 && args[0].equals("BB_push") )
{
System.out.println("====IN IF====");
theApp = new MyApp();
theApp.enterEventDispatcher();
}else if(args.length == 1 && args[0].equals("gui"))
{
System.out.println("====IN 1 GUI===");
// Create a GUI instance for displaying a DemoMessageScreen.
// This will occur when this application is invoked by the
// View Demo Message menu item.
MyApp messageScreenApp = new MyApp();
messageScreenApp.enterEventDispatcher();
}
else{
MessageListDemoDaemon daemon = new MessageListDemoDaemon();
// Register application indicator
EncodedImage indicatorIcon = EncodedImage.getEncodedImageResource("img/indicator.png");
ApplicationIcon applicationIcon = new ApplicationIcon(indicatorIcon);
ApplicationIndicatorRegistry.getInstance().register(applicationIcon, false, false);
ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance();
if(reg.getApplicationFolder(INBOX_FOLDER_ID) == null)
{
daemon.init();
}
try
{
daemon.enterEventDispatcher();
}catch (Exception e)
{
System.out.println("======catch after daemnon even===="+e);
}
// push notificationlistener===============
BackgroundApplication backApp=new BackgroundApplication();
register.registerBpas();
backApp.setupBackgroundApplication();
backApp.enterEventDispatcher();
}
}
试试这个-
public static void main(String[] args)
{
if(args != null && args.length > 0 && args[0].equals("gui"))
{
//Main Screen
}
else if(args != null && args.length > 0 && args[0].equals("Background1")) {
//First background application
}else{
//Second background application
}
在您的BlackBerry\u App\u Descriptor.xml上
1.应用程序-标记-启动时自动运行,不在主屏幕上显示应用程序图标。
2.备用入口点-A)。gui-取消选中-启动时自动运行,并且不在主屏幕上显示应用程序图标B)。Background1-标记-启动时自动运行,不在主屏幕上显示应用程序图标。这些被称为“入口点”,而不是侦听器。我建议你编辑标题以便进一步澄清。请更深入地解释您的问题是什么,什么不起作用,或者抛出了哪些异常(如果有的话)。