Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 08:07, 22 July 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to check if a specific API is supported in Java ME

From Wiki
Jump to: navigation, search



This code snippet demonstrates how to check whether a specific Java ME API is supported on the device and also what version is supported. In this snippet, the API to be checked is the Wireless Messaging API.

Note.pngNote: The method System.getProperty() can also be used for obtaining several other properties than API versions. See Getting System properties in MIDP for a list of possibilities.


import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
String wmVersion = System.getProperty("wireless.messaging.version");
if (wmVersion != null) {
// Wireless messaging is supported. Inform the user.
Alert alert = new Alert("Supported",
"Wireless messaging is supported. Version is: " + wmVersion,
null, AlertType.INFO);
} else {
// Wireless messaging is not supported. Inform the user.
Alert alert = new Alert("Not supported",
"Wireless messaging is not supported.", null,


The MIDlet displays an alert which shows whether the Wireless Messaging API is supported and if it is, which version is supported.

See also

This page was last modified on 22 July 2013, at 08:07.
78 page views in the last 30 days.