Join Now
Quality Rating:
  • Currently 3.0 / 5
(3.0 / 5 - 1 vote cast)
Expertise Level:
  • Currently 3.0 / 5
(3.0 / 5 - 1 vote cast)

This page was last modified 12:31, 14 May 2008.

CS000960 - Checking whether a specific Java ME API is supported

From Forum Nokia Wiki


ID CS000960 Creation date May 14, 2008
Platform S60 3rd Edition, FP1 Tested on devices Nokia N95 8GB
Category Java ME Subcategory Files/Data


Keywords (APIs, classes, methods, functions): java.lang.System, javax.microedition.lcdui.Alert, javax.microedition.lcdui.AlertType, java.lang.System.getProperty()

Overview

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: The method System.getProperty() can also be used for obtaining several other properties than API versions. See TSJ000306 - MIDP: System properties for a list of possibilities.

Source

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);
    Display.getDisplay(this).setCurrent(alert);
} else {
    // Wireless messaging is not supported. Inform the user.
    Alert alert = new Alert("Not supported",
        "Wireless messaging is not supported.", null,
        AlertType.INFO);
    Display.getDisplay(this).setCurrent(alert);
}

Postconditions

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

See also

Related Discussions
Thread Thread Starter Forum Replies Last Post
SIM Application Toolkit cybermaster Symbian Networking & Messaging 5 2007-10-21 21:09
PC freezing, total hang up. Disconnect of VPN connection. Jossnaz Mobile Java General 1 2006-10-21 00:51
Contacts and Its Properties gsrmsc Mobile Java General 1 2008-05-06 10:20
Online API Guide gavin_tranter General Symbian C++ 0 2004-10-20 10:25
How to get a larger size video recorded by CVideoRecorderUtility werewolflj Symbian Media (Graphics & Sounds) 13 2008-06-17 09:49
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX