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
New Developer
bumbyjumby
Posts: 11
Registered: ‎11-25-2008
My Device: Not Specified
Accepted Solution

problem launching browser from application

Hello,
In order to launch a browser from an application, I used the code snippet from this
page:

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800440/How_To_...

 

All I do is supply my own url to it, and launch it. It works great, and has
worked great until recently. A number of clients have complained about
receiving the following error message:

Uncaught exception: net.rim.device.api.system.ControlledAccessException

In tracking down the cause, I have tried on a number of different devices/
OS versions including:

Rogers Blackberry 8700 v4.2.1-----works fine
Rogers Blackberry 8800 v4.2.1-----works fine
Rogers Blackberry 8310 v4.2.2-----works fine
Bell Blackberry 8830 v4.2.2-----displays above error
Bell Blackberry 8130 v4.3.0-----displays above error

I have tried the Device Simulators:
v4.2.2.123  8830 Bell
4.3.0.07 8130 uscc
and they both worked fine.

We are going a bit mad here trying to figure out the cause. If it isn't OS
version related, perhaps it's a provider issue???
Is there a known issue with Bell relating to security of browser launching
applications? Is there a work-around?

thanks

New Developer
lanceo
Posts: 22
Registered: ‎07-17-2008
My Device: Not Specified

Re: problem launching browser from application

The article you reference lays it out.  Even more maddening is that the removal of that capability occurred during the 4.2.2 cycle, whereas some 4.2.2 devices work and some don't.  In this particular case the BB is not backward compabible.  The RIM folk say that the root of this was a security vulnerability, and closing that was deemed more important than preserving compatibility.

 

It is doubly unfortunate that the error presents itself as a controlledaccessexception instead of a compile time issue.  Simulators don't check permissions, so this doesn't show up during the development process.  You are not the first to fall into this.  

 

From the article...

Note: BlackBerry Device Software 4.2.2 prevents third-party applications from using a non-null value as an application argument. Therefore, the first code example will not work on BlackBerry smartphones running BlackBerry Device Software 4.2.2 and later. Instead, the second code example should be used.

New Developer
bumbyjumby
Posts: 11
Registered: ‎11-25-2008
My Device: Not Specified

Re: problem launching browser from application

Thanks for the response lanceo,

I noticed that note in the article when I first developed the apps quite a while ago, and did in fact suffer at the time from not noticing that note..heh.

Since I modified it as the article suggested, it has worked as expected on a number of devices..both pre 4.2.2 and post 4.2.2. The only difference being which provider the device is with.

As I previously noted, it works on a Rogers Blackberry with version 4.2.2, but not on the Bell with the same version, hence the confusion/frustration.

I should have mentioned that all apps are compiled using JDE 4.0.
New Developer
bumbyjumby
Posts: 11
Registered: ‎11-25-2008
My Device: Not Specified

Re: problem launching browser from application

Its not anything to do with the provider. Tested on simulator with security enabled and get the same problem...so at least I have something to test on.

 

 

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: problem launching browser from application

You have an application security issue. Different carriers set the defaults differently. Your application will inherit the default settings.

 

Settings / Security Options / Application Permissions

 

Select your application.

 

Set everything to "Allow" and restart the unit.

 

 

New Developer
bumbyjumby
Posts: 11
Registered: ‎11-25-2008
My Device: Not Specified

Re: problem launching browser from application

Thanks, but we did try that with no luck.

New Developer
bumbyjumby
Posts: 11
Registered: ‎11-25-2008
My Device: Not Specified

Re: problem launching browser from application

Still looking for a solution. Totally baffled..the code is brainless..

 

Here is the code that I use to launch the browser. As you can see, it is pretty much vertabim from the link I posted above. I just create an application, build it, sign it and load it up. We are really mystified as to what is happening. My colleague loaded version 4.5 onto his 8800 in order to test it and it still causes the ControlledAccessException.

 

The only thing I can think of now, is either some obscure device setting, or some other signing process that I dont know of. Any help would sure be great!

 

import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.ApplicationManagerException;
import net.rim.device.api.system.CodeModuleManager;

/**
 *
 */
class launcher extends net.rim.device.api.ui.UiApplication
{
  
    public static void main(String[] args)
    {
       boolean retval = true;
   
            int handle = CodeModuleManager.getModuleHandle("net_rim_bb_browser_daemon");
           
            if (handle <=0 ) {
                retval = false;
            } else {
                ApplicationDescriptor[] browserDescriptors = CodeModuleManager.getApplicationDescriptors(handle);
           
                if (browserDescriptors == null ) {
                    retval = false;
                }
                else
                {
                    if ( browserDescriptors.length <=0 ) {
                        retval = false;
                    } else {
                        String[] vargs = {"url", "http://www.google.ca"};
           
                        ApplicationDescriptor descriptor = new ApplicationDescriptor
                        (
                                browserDescriptors[0],
                                "url invocation", vargs,
                                null, -1, null, -1,
                                ApplicationDescriptor.FLAG_SYSTEM
                        );
           
                        try
                        {
                                ApplicationManager.
                                getApplicationManager().
                                runApplication(descriptor);
                        }
                        catch(ApplicationManagerException e)
                        {
                                retval = false;
                        }
                    }
                }
            }
    }   
  
}

New Developer
bumbyjumby
Posts: 11
Registered: ‎11-25-2008
My Device: Not Specified

Re: problem launching browser from application

Ok problem solved. Lanceo was right in referring me to the document that I initially brought up. I just stumbled on the wording. It was not blatantly obvious in the document as to which code snippet belonged to which version. Furthermore, one of my colleagues device running v4.2.2 did not suffer the problem. Where as the document basically says that it should have. I should have tried it anyway.

 

So I now have two versions of the same application. The code snippet on the bottom of the document

is used for versions 4.2.1 and lower. The code snippet at the beginning is used for 4.2.2 and up.

 

Thanks again for anyone who posted.