How to find mobile OS name and OS version using Java-ME?
I 开发者_JS百科need to find mobile OS name and OS version programmatically: like Symbian s40 3rd edition
or 5th edition
. How to achieve this in J2ME?
System.getProperty("microedition.platform");
It will return something like Nokia6310i/4.42.
See http://www.developer.nokia.com/Community/Discussion/showthread.php?86604-j2me-system-properties
http://developers.sun.com/mobility/midp/questions/properties/
I am not sure it is exactly what you need but this is what I can offer you.
You can also detect features programatically. Query the microedition.platform
to see if it's a Nokia. Then, check for the existence of APIs which distinguish the versions you are interested in. E.g., to check whether the Location API JSR179 is present:
boolean hasJSR179 = false;
try {
Class.forName("javax.microedition.location.LocationException");
hasJSR179 = true;
} catch (ClassNotFoundException e) { /* no JSR 179 */ }
精彩评论