Namespaces
Variants
Actions

Restricting a Java application to Nokia devices only

Jump to: navigation, search
SignpostIcon Upload 52.png
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
This page was last modified on 20 July 2012, at 09:39.
72 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved