2011-01-20 19 views
0

我有一个应用程序,它在自动启动时使用备用入口点注册其热点客户端,并在实际入口点(当单击应用程序图标时)注入应用程序UI。BlackBerry应用程序自动启动和备用入口点默认应用程序图标

实际的切入点 - 项目属性: *项目类型:黑莓应用程序和 *添加的应用程序图标

备选入口点 - 项目属性: *项目类型:替代黑莓应用程序入口点 *替代入口点为:“实际项目” *转交给主的参数:权限 *系统模块检查 *自动检查开始 *并且没有添加图标

当我在设备上运行应用程序appln启动备用入口点时,启动并注册热点客户端,但它在后台应用程序列表中添加了具有项目名称(.jdp文件名)的默认图标。我不希望任何图标显示为备用入口点。

当我点击下载文件夹中的应用程序图标时,应用程序推送了UI屏幕,现在如果我看到后台应用程序列表,我会看到具有给定应用程序名称和默认应用程序图标以及我的项目名称的应用程序图标的替代入口点。那么,如何禁用此默认图标以显示在备用入口点的后台应用程序列表中。

如果我缺少任何东西并帮助我,请告诉我。

这里是我的代码:

class WiFiApplication extends UiApplication 
{ 
    public static void main(String[] args) 
    { 
     if(args != null && args.length > 0 && 
      args[0].equals("wificlient")) 
     { 
      //Register the Hotspotclient 
      AddRemoveClient.registerHotspotClient(); 
      WiFiApplication app = new WiFiApplication(); 
      app.enterEventDispatcher(); 
     } 
     else 
     { 
      new WiFiApplication().pushUI(); 
     } 
    } 

    WiFiApplication() { 
    } 

    pushUI() 
    { 
     pushScreen(new WLANScreen()); 
     enterEventDispatcher(); 
    } 
} 

回答

2

我不知道这是否会完全回答你的问题,因为我是新来替换入口点,但我已经创建了一个不使用后台程序替代入口点,并将以与您相同的方式来到前台。在我的main()方法中,我不直接调用构造函数,我有一个getInstance()方法在应用程序上强制实施Singleton模式 - 换句话说,如果它已经在后台运行,它是带到前面。

/** 
* Returns a Demo application. If Demo has not been started yet, it is 
* started. If it is already running, this method returns the running 
* instance. In this way, only one copy of the Demo application can ever 
* be running. 
* 
* @return a running instance of the {@link DemoApp} 
*/ 
public static DemoApp getInstance() 
{ 
    // check if Demo is already running in the background 
    RuntimeStore runtimeStore = RuntimeStore.getRuntimeStore(); 
    DemoApp runningInstance = (DemoApp) runtimeStore 
     .get(GlobalConstants.Demo_APPLICATION_INSTANCE_ID); 

    // if not running, create the app, and store it as an object in the 
    // RuntimeStore 
    if (runningInstance == null) 
    { 
     runningInstance = new DemoApp(); 
     runtimeStore.put(GlobalConstants.Demo_APPLICATION_INSTANCE_ID, 
      runningInstance); 
    } 

    return runningInstance; 
} 

我定义Demo_APPLICATION_INSTANCE_ID作为com.demo.app长哈希(一些独特的名称)。

这会将正在运行的应用程序的副本存储在RuntimeStore中。

最后,我没有实现从任务切换器隐藏后台应用程序的部分,因为我希望能够切换到它。但是,如果那是你正在尝试做的,然后去这个链接: http://davidjhinson.wordpress.com/2010/08/24/hiding-blackberry-background-processes/

心连心

+0

你提供了我需要的解决方案的链接。谢谢理查德 – 2014-05-06 11:49:20