BlackBerry 应用程序自动启动和备用入口点默认应用程序图标

发布于 2024-10-13 06:41:26 字数 1223 浏览 6 评论 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();
    }
}

I have an application which registers its hotspotclient on autostart with an alternate entry point and on the actual entry point (when the application icon is clicked) it pushes the application UI.

Actual entry point - project properties:
* Project Type: BlackBerry application and
* Added Application icon

Alternate entry point - project properties:
* Project Type: Alternate Blackberry Application entry point
* Alternate entry point for: "actual project"
* Argument passed to main: wificlient
* System module checked
* Auto start checked
* and No icon added

When I run the application appln on the device start up the alternate entry point, starts and registers the hotspot client, but it adds the default icon with the project name (.jdp file name) in the background application list. I don't want any icon to be displayed for alternate entry point.

When I click on an application icon from a download folder the app pushed the UI screen and now if I see the background application list, I see my application icon with the given application name and the default application icon with my project name of the alternate entry point. So how do I disable this default icon to display in background application list for the alternate entry point.

Please let me know if I am missing anything and help me with this.

Here is my code:

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();
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阳光①夏 2024-10-20 06:41:26

我不确定这是否能完全回答您的问题,因为我是备用入口点的新手,但我创建了一个不使用备用入口点的后台应用程序,并且将以与您的相同的方式进入前台。

在我的 main() 方法中,我不直接调用构造函数,我有一个 getInstance() 方法,该方法在应用程序上强制执行单例模式 - 换句话说,如果它已经在后台运行,则会将其带到前台。

/**
 * 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/隐藏-blackberry-background-processes/

hth

I'm not sure if this will fully answer your question, since I am new to alternate entry points, but I have created a background app that doesn't use alternate entry points, and will come to the foreground in the same way as yours.

In my main() method, I do not directly call the constructor, I have a getInstance() method that enforces the Singleton pattern on the application - in other words, if it is already running in the background, it is brought to the front.

/**
 * 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;
}

I define Demo_APPLICATION_INSTANCE_ID as a long hash of com.demo.app (some unique name).

This stores a copy of the running app in the RuntimeStore.

Finally I did not implement the part of hiding the background app from the task switcher, since I wanted to be able to switch to it. But if that is what you are trying to do, then go to this link:
http://davidjhinson.wordpress.com/2010/08/24/hiding-blackberry-background-processes/

hth

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文