[Windows Mobile Development and Hacking General] Menneisyys:
3. Introduction to using MIDlets

Now, let’s see how you can install (deploy) MIDlets on your Windows Mobile device and how you can use them. Fortunately, doing this is very simple.

First, make sure you do have a KVM on your handheld. If you don’t, install one. If you have a non-phone Pocket PC and want to use any MIDlet manager (except for IBM J9), make sure you install the SMS.dll and Phone.dll hacks and / or if you have a pre-WM5 device, you’ll need to choose from either IBM J9 or old versions of TAO Intent.

After this, your life will be pretty easy.

3.1 Two ways of deployment (installation): online vs. offline

In general, there are a lot of MIDlets available online. In general, if you click them on the Web from your Windows Mobile device (preferably, using a built-in Web browser), they get downloaded to your handheld and automatically deployed in your device. The same happens with JAR files you copy to your handheld and, then, deploy them locally by either making your KVM explicitly search for it or clicking it / pressing the Action button from a local file manager. In the following two subsections, I elaborate on these questions.

Note that, generally, there are two kinds of files you’ll run into: JAD files and JAR files. When you download a MIDlet to your desktop PC so that you can, later, deploy it into your handheld’s KVM, only download JAR files, not the JAD ones.

If there’s no way of directly accessing JAR files, only JAD ones (as is, for example, the case with the Opera Mini 4 beta download page HERE - note that you should visit it from a Wap-capable desktop browser (Opera), that is, NOT from IE!), the “Download high memory version” download link will download you a JAD file, not a JAR one. You can directly copy this file to your handheld but, then, it’ll need to have Internet connection to be able to download the JAR file referenced by the small JAD file. If you can’t guarantee this or prefer collecting the JAR files offline, do the following: open the JAD file you downloaded with a text / file viewer (editor) and look for the attribute named “MIDlet-Jar-URL”. Copy the URL after the colon (for example, http://mini.opera.com/dl/1B8GM15aEP5uj-jE8A4AACMhDw8C/mini.jar) to your desktop Web browser. Now, you’ll have direct access to the JAR file – you can already safely save it.

Note that some KVM’s support separating MIDlets into different folders. Some allow for selecting the folder at deployment time (an additional step in the deployment process; this is what, initially, the “root” screen stands for when deploying into Esmertec products), the others after deployment. (And, on the Nokia, as it has no MIDlet manager interface at all but all deployed MIDlets are listed as regular applications, you can use the system file explorer tools to move them elsewhere, in another folder. This is slightly different from the way MIDlets were handled or early MIDlet-capable Nokia phones like the N-Gage, where there was a separate folder for them.) Also see the “Possible to use folders for better MIDlet separation?” row in the main chart for more info & screenshots.

Also note that, during the deployment process, you will also need to let the installation continue, particularly when the given MIDlet isn’t signed with a trusted certificate. (The vast majority of MIDlets are like this.) This, in general, only means you will need to press the left softkey some times on both Windows Mobile and Symbian.

3.1.1 Offline: originating the deployment from inside the manager vs. doing the same from the outside

There are two ways of deploying a local MIDlet JAR file to your MIDlet browser. The easiest is the default way of just clicking / pressing the Action key while viewing it from a local file explorer tool. This, as long as the file associations are correctly set (which may NOT be the case if you install more than one KVM’s on your handheld – more on this later), will automatically invoke the JVM and deploy the MIDlet.

Another way to select the related menu item inside the given KVM is to search for JAR files in the local file system (for example, Menu / Install / Local with TAO and Menu / Install / Local Files with Esmertec’s KVM’s). Unfortunately, it’s pretty flawed with most of the KVM’s; for example, the lack of alphabetical sorting, some of them can’t display all the files at once if there are more than 200-250 of them, some are only looking in a given directory or have no search capabilities at all, which is the case with IBM J9. The latter, as it doesn’t allow for browsing the file system for a given JAR file, forces you to enter the full (local, that is, Error! Hyperlink reference not valid. ) URL of the JAR file, which is really a pain in the back. Finally, Jblend doesn’t offer any local file browsing / deployment at all – with it, you must initiate the deployment from any file explorer tool. The latter is “only” highly recommended with other KVM’s because of the other annoyances and bugs they have.

3.1.2 Online

This is much easier: you just navigate to the given page with the MIDlets online and just click the JAD (or JAR) files. Note that some KVM’s may not allow for installing Web-based JAR’s directly; with them, you will need to click the JAD file instead. This is in stark contrast with the local install: all the tested (non-disqualified) browsers allow for the direct installation of JAR files and no local JAD’s are needed.

3.2 Running the already-deployed MIDlets

After your MIDlet is deployed, you will need to click it from inside the KVM if it’s not started automatically: most current, recommended KVM’s ask the user whether the MIDlet should be started right after the deployment.

Otherwise, you just start the KVM environment (it’s, in general, in the main Start Menu / Programs folder (except for the HTC Kaiser / Tilt, where it’s in the Tools subdirectory there) and is called “Jbed”, “Java”, “Jeodek” or “Esmertec Jbed/Jeodek” with the Esmertec products, “MIDlet Manager” with TAO Intent, “Midlet HQ” with IBM J9 (linking emulator.exe) and “Jblend” with Jblend) and simply double-click the given, already-deployed MIDlet. With IBM J9, you must select the uppermost “Launch” menu item in Actions instead, after highlighting your MIDlet.

Now that I’ve made it clear it’s only Nokia’s (Symbian) MIDlet manager that puts the deployed MIDlet icons in the traditional Applications folder, you may also want to know whether you can also hack the Windows Mobile KVM’s to do the same. This, as you may have already guessed, also greatly speeds up starting a given MIDlet: you don’t need to start an additional layer of managers. The answer is: yes, with most KVM’s (except for Jblend), you can. Then, you won’t need to separately start the KVM interface to gain access to the deployed MIDlets. See the “Direct, system-level links (shortcuts) to MIDlets” row in the main chart for more info on this. Note that, as opposed to Nokia’s system-level links (or, for that matter, the way the excellent Palm OS emulator, StyleTap, works on Windows Mobile), all these links will have the same icon, unlike under Symbian – not that of the icon of the MIDlet itself. This is a definite disadvantage if you prefer looking for a MIDlet based on its icon and not its name / position.

3.3 Security issues

Unlike with native Windows Mobile (or Symbian) applications, you’ll always run into security prompts. Therefore, it’s worth knowing a bit about what they are all about.

Java programs, in general, put a lot of weight on security measurements. This is why they continuously prompt the user when they try to access “sensitive” resources like the Net or the local file system.

Fortunately, you can, in general (except for Jblend), easily get rid of this problem:

- if you have any of the Esmertec KVM’s, use the MIDlets signed by the MXit LifeStyle-signed JAR’s available in THIS thread. Note that I’ve separately linked in the most common non-game (games, in general, aren’t affected by these issues, unless they want to use Bluetooth) MIDlets you may want signed. Then, you’ll be able to set their security model for “Blanket”, which means you’ll never be prompted for permission. It’ll certainly be easier for you than with the default “Session” (you’re asked once per session – that is, after starting the MIDlet) and the even more restrictive “One Shot” security model. Incidentally, Jblend employs exclusively the latter model with accessing the Net; this means it’s pretty much useless for applications like Opera Mini or the Gmail MIDlet. This is particularly true with the Gmail client, where it prompts the user to allow going on upon downloading every single mail (header). That is, never use Gmail under Jblend.

- if you have a KVM where you can “hack” the security descriptor files (all Esmertec KVM’s and IBM J9 belong to here; TAO Intent is also said to be but the opinions do differ on the latter and I haven’t tested this hack), do the hacking to get rid of the annoying security prompts. See the “Security: Allow permanent Net access without prompting ("Blanket" security model, as opposed to "Session" / "Oneshot")?” row in the main chart for more info / links.