【问题标题】:blackberry alternate entry point- start app from background application(on push message click)黑莓备用入口点 - 从后台应用程序启动应用程序(点击推送消息)
【发布时间】:2012-07-19 06:35:00
【问题描述】:

我想从后台应用程序打开我的 UI 应用程序。它是怎么做的?。

public static void main(String[] args) {
   if (args.length > 0 && args[0].equals("MYAPP") ){
      theApp = new App();
      theApp.enterEventDispatcher();  ///this  is my ui class
   }
   else {
      BackgroundApplication app = new BackgroundApplication();
      app.setupBackgroundApplication();
      app.enterEventDispatcher();  ///this is a background application listen for push notifications
   }
}

当我收到推送通知时,BackgroundApplication 应该会弹出一个警报。 当我单击弹出窗口时,我希望它打开 UI 屏幕。这是怎么做的?我试过这个:

int modHandle = CodeModuleManager.getModuleHandle("MYAPP");
     ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
     try {
        ApplicationManager.getApplicationManager().runApplication(apDes[0]);
     } catch (ApplicationManagerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
     }

但它没有打开 UI。

【问题讨论】:

    标签: blackberry push-notification


    【解决方案1】:

    您应该将参数“MYAPP”传递给运行应用程序的代码:

    ApplicationDescriptor[] appDescriptors =
    CodeModuleManager.getApplicationDescriptors(
            CodeModuleManager.getModuleHandle("MYAPP"));//.Cod file name
    ApplicationDescriptor appDescriptor = new ApplicationDescriptor(
    appDescriptors[0], new String[] {"MYAPP"});
    ApplicationManager.getApplicationManager().runApplication(appDescriptor);
    

    阅读更多here

    【讨论】:

    • 什么是“param1”、“param2”、“param3”、“param4”?
    • 什么是 "yourMDSRuntimeCodFileName" 。和“MYAPP”一样吗?
    • 是否可以在应用上推送特定页面?
    • @JaneRaj 这是您的 cod 文件名,没有“.cod”扩展名(可能是“MYAPP”)
    • @EugenMartynov 如果我有一个 home.java 类在应用程序中。我想推那个页面。所以我必须这样给? ApplicationDescriptor appDescriptor = new ApplicationDescriptor(appDescriptors[0], new String[] {"home"}); ?
    猜你喜欢
    • 2012-01-22
    • 2010-12-30
    • 2013-09-07
    • 2011-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-15
    相关资源
    最近更新 更多