Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Java ME Permissions check returns not found error S60 3rd Edition (Known Issue)

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Tested with
Devices(s): S60 3rd Edition, S60 3rd Edition FP1, S60 3rd Edition FP2 devices
Created: User:Technical writer 1 (23 Oct 2008)
Last edited: hamishwillee (31 Jul 2013)



Checking API permissions using checkPermission() produces -1 with S60 devices even if the checked permission has been manually set with Application Manager.


According to the MIDP 2.0 specification, the API permission status can be checked with the checkPermission(String permissionAsStringValue) method. If an API on the device defines the specific permission requested, the method returns 1 (the permission is allowed by the device). If no API on the device defines the specific permission requested, the method returns 0 (the permission is to be reported as denied). If the status of the permission is not known because it might require user interaction, the method returns -1 (the permission is to be reported as unknown).

With S60 devices, the result will be -1 if the related API with its methods are not called during startup of the MIDlet which checks the API permission. This differs from the behaviour of Series 40 devices which investigate whether a checked permission has been set by Application Manager and if so, resulting in 1.

How to reproduce

The below example checks contact list read and write permissions for the PIM API (JSR-75).

1. Write the following source code

 import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class Permission extends MIDlet{
... // pauseApp() and destroyApp() methods excluded from this example
protected void startApp() throws MIDletStateChangeException {
Form f = new Form("Permissions");
f.append("Contacts Read: "
+ checkPermission("")+"\n");
f.append("Contacts Write:"
+ checkPermission("javax.microedition.pim.ContactList.write")+"\n");

2. Include the related permissions in the JAD:


3. Sign the MIDlet using a third party certificate.

4. After installing the MIDlet to a S60 device, set the permissions for the MIDlet from Application Manager as follows:

Read user data: Always allowed
Edit user data: Always allowed

4. Launch the signed MIDlet. The result for permission check will be as follows:

Contacts Read: -1
Contacts Write: -1

To get the permission check to return 1, it is necessary to include the related API and the API method(s) which require the permissions for using the API methods. In the PIM example, it is necessary to import the PIM API and include the PIM Contact list instance together with the accessing method:

 import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.pim.*; // import the PIM API
public class Permission extends MIDlet{
PIM pim;
PIMList pl;
... // pauseApp() and destroyApp() methods excluded from this example
protected void startApp() throws MIDletStateChangeException {
try {
pim = PIM.getInstance(); // Obtaining a PIM instance
pl = pim.openPIMList(pim.CONTACT_LIST, pim.READ_WRITE); // Access contacts list
Form f = new Form("Permissions");
f.append("Contacts Read: "
+ checkPermission("") + "\n");
f.append("Contacts Write: "
+ checkPermission("javax.microedition.pim.ContactList.write") + "\n");
} catch (PIMException ex) {

After including the related API and API methods in the source code, repeat steps 2-4. For step 4, the result will be 1, which means that the API permissions are allowed.


This problem is expected to be fixed in future software versions.

This page was last modified on 31 July 2013, at 10:14.
27 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.