我有一个应用程序,它在自动启动时使用备用入口点注册其hotspotclient,并在实际入口点(当单击应用程序图标时)推送应用程序UI。
实际入口点 - 项目属性: *项目类型:BlackBerry应用程序和 *添加了应用程序图标
备用入口点 - 项目属性: *项目类型:Alternate Blackberry Application入口点 *替代入口点:“实际项目” *参数传递给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();
}
}
答案 0 :(得分: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