Obtenir les propriétés de l'application
MIDlet.getAppProperty("property");

où "property" peut être :

  • MIDlet-1
  • MIDlet-Jar-Size
  • MIDlet-Jar-URL
  • MIDlet-Name
  • MIDlet-Permissions
  • MIDlet-Vendor
  • MIDlet-Version : 1.0.10

Pour une numérotation correcte de la version du MIDlet suivez MIDlet Suite Versioning

La documentation JSR-000118 Mobile Information Device Profile 2.0 indique :

Attribute names are case-sensitive and MUST match exactly. An attribute MUST NOT appear more than once within the manifest. If an attribute is duplicated the effect is unspecified. The MIDlet retrieves attributes by name by calling the MIDlet.getAppProperty method. The application descriptor MUST contain the following attributes:

  • MIDlet-Name
  • MIDlet-Version
  • MIDlet-Vendor
  • MIDlet-Jar-URL
  • MIDlet-Jar-Size

In addition, to improve the user experience (by rejecting incompatible suites without needing to download the JAR file), the application descriptor SHOULD contain the following attributes:

  • MicroEdition-Profile
  • MicroEdition-Configuration
  • MIDlet-Permissions

The application descriptor MAY contain:

  • MIDlet-<n> for each MIDlet
  • MicroEdition-Profile
  • MicroEdition-Configuration
  • MIDlet-Description
  • MIDlet-Icon
  • MIDlet-Info-URL
  • MIDlet-Data-Size
  • MIDlet-Permissions (une petite doc Java ME permission attributes in Jad and MANIFEST)
  • MIDlet-Permissions-Opt
  • MIDlet-Push-<n>
  • MIDlet-Install-Notify
  • MIDlet-Delete-Notify
  • MIDlet-Delete-Confirm
  • Any application-specific attributes that do not begin with MIDlet- or MicroEdition-
Obtenir les propriétés CLDC
System.getProperty("property");

où "property" peut être :

  • microedition.platform -> Name of the host platform or device : SunMicrosystems_wtk
  • microedition.configuration -> Name and version of the supported configuration : CLDC-1.1
  • microedition.profiles -> Names of all supported profiles : MIDP-2.0
  • microedition.encoding -> Default character encoding set used by the platform : ISO8859_1
  • microedition.locale -> Name of the platform's current locale : fr-FR

Pour les autres valeurs possibles de "property" suivez les liens de la page J2ME : JSR disponibles sur le mobile dans la section "Liste des correspondances JSR et Property Name"

Gestion de la mise à jour automatique du MIDlet

La documentation JSR-000118 Mobile Information Device Profile 2.0, dans la description de public final boolean platformRequest(String URL) indique :

If the URL specified refers to a MIDlet suite (either an Application Descriptor or a JAR file), the application handling the request MUST interpret it as a request to install the named package. In this case, the platform's normal MIDlet suite installation process SHOULD be used, and the user MUST be allowed to control the process (including cancelling the download and/or installation). If the MIDlet suite being installed is an update of the currently running MIDlet suite, the platform MUST first stop the currently running MIDlet suite before performing the update. On some platforms, the currently running MIDlet suite MAY need to be stopped before any installations can occur.

Invoking Platform Services in MIDP 2.0 indique :

Using the Request Method

The platformRequest() method takes one input argument, a String URL that it passes to the platform's application management software (AMS). The AMS examines the scheme of the URL, and if appropriate logic is available loads or invokes the appropriate service. An empty non-null URL string cancels any pending platform requests. The platformRequest() method returns true if the MIDlet suite must exit before the external platform service can be invoked, and it throws a ConnectionNotFoundException if the platform cannot handle the URL argument.

The MIDP 2.0 specification defines two URL schemes and corresponding platform services:

* If the URL points to a MIDlet suite's JAD or JAR file, for example http://www.j2medeveloper.com/ota/basicpush.jad, the platform request is for download and installation of the MIDlet suite, using the platform's normal installation process. * If the URL scheme is tel:, for example tel:+358-555-1234567, the URL must be passed to the device's application responsible for initiating voice calls.

Device manufactures are free to implement additional platform services. For example, one likely platform service would be to invoke a web browser when the MIDlet supplies an http: URL such as http://developers.sun.com/mobility.

It's important to understand that platformRequest() is a non-blocking method, and that the specification doesn't require platforms to queue multiple calls. On some platforms, only the most recent call to platformRequest() will be honored.

MIDlet Life-Cycle Considerations

You must take the MIDlet life-cycle into account when you use platformRequest().

Some MIDP platforms are more restricted than others. For example, some don't support concurrent processing, so the MIDlet must exit before the platform can honor a service request. Recall that platformRequest() returns true in such cases, giving your MIDlet fair warning that it must exit.

If the platform request is to download and install an update of the currently loaded MIDlet suite, the currently running MIDlet is first terminated.

In both these cases, the MIDlet must be prepared to exit gracefully, first managing its state so as to resume appropriately later.

Déploiement de l'application mobile Le déploiement peut se faire de deux façons :

  • Déploiement physique : Ce déploiement se fait en connectant le téléphone à l'ordinateur (USB, port série, Bluetooth, Infrarouge) après avoir téléchargé les deux fichiers j2meProgramme.jar et j2meProgramme.jad depuis le site qui héberge ces 2 fichiers.
  • Déploiement via OTA(Over The Air) : Ce déploiement se fait par le biais du WAP.

Le déploiement d'une MIDlet dans un terminal J2ME MIDP doit être conforme à la norme MIDP OTA Provisioning. Selon cette norme, le terminal doit contenir un navigateur ou une application de découverte pour accéder au service de découverte des fournisseurs. La communication se fait par HTTP 1.1 avec HTTP Basic Authentication.
De plus, le terminal doit contenir un AMS (Application Management Software) aussi appelé JAM (Java Application Manager) pour manipuler le cycle de vie de la MIDlet. L'AMS commence par télécharger le descripteur JAD et offre à l'utilisateur la possibilité d'initier le téléchargement de l'archive. L'AMS se charge de l'installation, de la mise à jour, et de la désinstallation des MIDlets. Il peut envoyer des notifications au serveur indiquant l'état de l'installation et de la désinstallation (MIDlet-Install-Notify et MIDlet- Delete-Notify dans le JAD).
Pour pouvoir installer un programme en utilisant OTA, il faut tout d'abord s'assurer de la compatibilité du mobile. Le principe de OTA est celui-ci :

  • Le téléphone se connecte sur le site WEB ou WAP.
  • Une page s'affiche, elle contient la ou les applications disponibles.
  • Une application est sélectionnée.
  • Le téléphone télécharge cette application dans sa mémoire.
  • Le téléphone installe l'application.

Petite astuce à propos du téléchargement du .jad, comme l'indique download your application Over The Air (OTA), il faut rajouter un handler sur votre serveur web :

Si vous accédez au serveur Web contenant votre JAR et JAD avec votre appareil, vous obtiendrez peut être le fichier JAD comme un fichier texte avec son contenu affiché comme du texte normal. Cela signifie que votre serveur Web doit être configuré.

Vous avez besoin d'associer des types MIME aux extensions ".jar" et ".jad" de sorte que le serveur Web peut dire au client le type de contenu. Dans Apache, vous ajoutez les deux lignes suivantes au fichier de configuration httpd.conf:

AddType text/vnd.sun.j2me.app-descriptor .jad
AddType application/java-archive .jar
Ressources :

JSRs: Java Specification Requests