Restricting a Java application to Nokia devices only
Article Metadata
Tested with
Devices(s): All
Compatibility
Platform(s): All
Article
Created: User:Technical writer 2
(19 Dec 2006)
Last edited: hamishwillee
(20 Jul 2012)
Overview
This article shows how to restrict installation of a Java ME MIDlet to Nokia devices only.
Description
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 comments yet)