0

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

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

备用入口点 - 项目属性: * 项目类型:备用黑莓应用程序入口点 * 备用入口点:“实际项目” * 传递给 main 的参数:wificlient * 检查系统模块 * 检查自动启动 * 并且没有添加图标

当我在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();
    }
}
4

1 回答 1

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/

hth

于 2011-04-12T14:38:37.840 回答