| ID | TSJ000516 | Creation date | December 19, 2006 |
| Platform | All | Devices | All |
| Category | Java | Subcategory | MIDP |
| Keywords (APIs, classes, methods, functions): |
Restricting a Java application to Nokia devices only
If you want to create an application that works only on Nokia devices and cannot be used on other manufacturer’s devices, use the standard system property: "microedition.platform". Nokia devices always use the same format for the return value containing the device model and the software version, for example "NokiaN93-1/10.0.012". It is possible to look for the string "Nokia" in the property and close the MIDlet with or without notifying the user.
Code example:
//Begin
// Check that the platform is there
String platform = System.getProperty("microedition.platform");
if ( platform != null )
{
if(platform.toLowerCase().indexOf("nokia")== -1) {
// Not running on a Nokia device.
// Remove Start possibility.
log("Closing application");
//Close MIDlet
}else{
log( "Nokia device: " + platform + " found.");
//Initialize MIDlet
}
}else
{
//Close MIDlet
}
//End
No related wiki articles found