Hiding applications from Task Manager

In Symbian, MIDlets can be hidden from Task Manager. When used together with Display.setCurrent(null), a MIDlet can be hidden on the system, in effect running in the background like a server. The only visual clue revealing that the application is running is a small circle over the application icon on the device main menu. The application is also visible in Application Manager and can be uninstalled from there, unless the application has the JAD attribute Nokia-MIDlet-Block-Uninstall set to true. In this case the application cannot be uninstalled by the end user.

Applications are hidden from Task Manager with the platformRequest scheme defined below. For more information on platformRequest, see Invoking applications in Java ME.

  • To hide the MIDlet from Task Manager, call jrt:taskmanager?hide_app

  • To show the MIDlet in Task Manager, calljrt:taskmanager?show_app

The feature is available only to Manufacturer and Operator domain applications. If the MIDlet is not bound to one of these two domains, ConnectionNotFoundException is thrown.

When platformRequest is used to hide the MIDlet, the MIDlet is hidden Task Manager, but not from the application list or Application Manager. Show or hide calls do not have impact on whether application is running in foreground or background. Calling show does not bring application to foreground and hide does not set application to background. These calls only manage application visibility in Task Manager.

Code samples

To hide from Task Manager:

try
{
    boolean mustExit = myMIDletInstance.platformRequest("jrt:taskmanager?hide_app");
}
catch (ConnectionNotFoundException nfe)
{
    // React to error.
}

To show in Task Manager:

try
{
    boolean mustExit = myMIDletInstance.platformRequest("jrt:taskmanager?show_app");
}
catch (ConnectionNotFoundException nfe)
{
    // React to error.
}

Best practises

It is good for a MIDlet designed to run in the background to implement some sort of an UI (for example, "About this application"). Otherwise the user gets no visual indication when they click the application icon to launch the MIDlet, resulting in bad user experience.

Also it is recommended to set application to background, call Display.setCurrent(null), after hiding the application from the Task Manager.

Related technologies

  • To set an application to background, the application can call Display.setCurrent(null).

  • To disable the Splash-screen, use the Nokia-MIDlet-Splash-Screen-Image manifest attribute. This allows starting with the application silently in the background

  • To set an application to automatically start on device start up, use the Nokia-MIDlet-auto-start manifest attribute.

  • To enable startApp() and pauseApp() calls to received background and foreground events, use the Nokia-MIDlet-Background-Event manifest attribute value pause. This JAD parameter combined with hide and show platformRequest calls can be used to enable full hiding automatically. When the application goes to background it is hidden from Task Manager and when it comes back to foreground it is be added to Task Manager. Please note that startApp() can be called many times.

  • The application provider can prevent uninstallation of the application with Nokia-MIDlet-Block-Uninstall JAD/JAR attribute. This attribute is available only for Operator and Manufacturer applications.

Example use case

Email receiving starts silently on background, when the device is started. (See Auto-starting MIDlets). It operates in server mode and receives emails automatically. When an email is received, the application can appear in foreground to show the new email.

The user has possibility to bring the email application to foreground at any time by starting it from the application icon. Then the normal email application UI is shown. After the user has processed emails they can select 'hide' from the application UI to set it back to server mode. For example, the application can send emails on background mode so the user does not need to wait for them to be processed before hiding the application.