Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 553
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700
My Carrier: Movistar, Telenor
Accepted Solution

Problem with ApplicationPermissions

Running the code below on 4.5 with simulator

 

get error :

Fail i checkPermissions java.lang.IllegalArgumentException

 

code:

 

package moblib;
import net.rim.device.api.applicationcontrol.ApplicationPermissions;
public class checkPermissions
{
  private ApplicationPermissions permissions = new ApplicationPermissions();
  private Communicator comm = new Communicator();
  private Redirector_settings settings = new Redirector_settings();
  private int allow = permissions.VALUE_ALLOW;
  private int ret;
 
  public String check()
  {
     String message = "";
     
  try
    {

/*  4.5  */
   ret = permissions.getPermission(permissions.PERMISSION_INTER_PROCESS_COMMUNICATION);

 

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Problem with ApplicationPermissions

This is expected.  You will receive an IllegalArgumentException for any permission type you check for because none have been added.  From the JavaDocs:

 

 

ApplicationPermissions (BlackBerry JDE 5.0.0 API Reference)

<script type="text/javascript">// function windowTitle() { parent.document.title="ApplicationPermissions (BlackBerry JDE 5.0.0 API Reference)"; } // </script>

getPermission

public int getPermission(int permission)
Returns the value for a permission.

 

Parameters:
permission - the permission whose value to return; valid values are any of the PERMISSION_ constants.
Returns:
the value of the specified permission; will be equal to one of the VALUE_ constants.
Throws:
IllegalArgumentException - if permission is not a valid value or if permission has not been added; that is, this.containsPermissionKey(permission) returns false.
See Also:
ApplicationPermissions.addPermission(int)
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.1
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker