×
Namespaces

Variants
Actions

Restricting a Java application to Nokia devices only

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): All
Compatibility
Platform(s):
MIDP 2.0
MIDP 1.0
Article
Created: User:Technical writer 2 (19 Dec 2006)
Last edited: hamishwillee (24 Jul 2013)

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
This page was last modified on 24 July 2013, at 08:45.
37 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×