BlackBerry application autostart and alternate entry point default application icon
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();
}
}
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
精彩评论