A MIDlet requests permissions by declaring them in the application descriptor, using either MIDlet-Permissions or MIDlet-Permissions-Opt. Multiple permissions can be specified and are separated by commas. If a permission is declared in MIDlet-Permissions, then the MIDlet suite must be granted access to a protection domain with this permission.
If a MIDlet can’t gain access to an appropriate protection domain, the installation is aborted. However, if the permission is declared in MIDlet-Permissions-Opt, and the MIDlet suite fails to gain access to an appropriate protection domain, the installation can continue but the suite will not have access to the requested permission. So, if your MIDlet suite depends on having a permission, and cannot operate without it, this permission should be requested in MIDlet-Permissions.
If your application can live without a specific permission, but would make use of the feature if access is granted, request the permission using MIDlet-Permissions-Opt.
The following is an example of requested permissions in a JAD file. The MIDlet suite is indicating it must have access to HTTP and HTTPS and would like to have access to the PushRegistry, VideoControl.getSnapshot, and SMS. If the latter three are denied, the suite can adjust and still provide value to the user.
MIDlet-Permissions: javax.microedition.io.Connector.http, javax.microedition.io.Connector.httpsMIDlet-Permissions-Opt: javax.microedition.io.PushRegistry, javax.microedition.media.control.VideoControl.getSnapshot, javax.wireless.messaging.sms.receive, javax.wireless.messaging.sms.send
In this example, HTTP and HTTPS are not requested as optional. Because the application has indicated it cannot function without these resources, if the device is unable to grant these permissions on installation, the installation will abort.