Launch the application from a url in the browser for BlackBerry?

I'm developing an application where I will launch a url in the browser where I run my application.

Suppose if I click google.com , and then press enter, it will launch my app. For this, I tried with the HttpFilterRegistry API.

For reference, I use the HTTPFilterDemo application. But currently while launching the application, I get the NullPointerException .

I wrote the code below I have the openFilter method:

  public Connection openFilter( String name, int mode, boolean timeouts ) throws IOException
    {
        Logger.out("Protocol", "it is inside the openFilter method");
        _url = name.substring(2);
        _requestHeaders = new HttpHeaders();
        _responseHeaders = new HttpHeaders();
        _responseHeaders.setProperty(HttpProtocolConstants.HEADER_CONTENT_TYPE, "text/html");

        // Attempt to parse for the file name
        int slashIndex = name.indexOf('/', 2);
   if (_resultData == null)
        {

final int modHandle = CodeModuleManager.getModuleHandle("AppLaunchBrowser");
                    Logger.out("Protocol", "here is the module handle:::" +modHandle);
                    final ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
//                  final String[] arguments = new String[1];
                    final ApplicationDescriptor appDescriptor = new ApplicationDescriptor(apDes[0], new String[]{});
                    Logger.out("Protocol", "here is the app descriptor:::" +appDescriptor);
                    try {
                        final int appCode = ApplicationManager.getApplicationManager().runApplication(appDescriptor, true);
                        Logger.out("Protocol", "here is the app code:::" +appCode);
                    } catch (ApplicationManagerException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
     }
        return this;
    }

And I am creating alternative entry point in the application class and using as below:

public class AppLaunch extends UiApplication{
    public static void main(String args[])
    {
        Logger.out("AppLaunch", args+"length of the arguments::::" +args.length);
        if((args != null) && (args.length > 0) && (args[0].equals("background")))
        {
            Logger.out("AppLaunch", "in the alternate entry point");
//          Logger.out("AppLaunch", args+"length of the arguments::::" +args.length);
            HttpFilterRegistry.registerFilter("www.google.co.in", "com.innominds.ca", false);

        }
        else
        {
            Logger.out("AppLaunch", "Inside the Applaunch");
            AppLaunch theApp = new AppLaunch();
            theApp.requestForeground();
            Logger.out("AppLaunch", "created the app launch object");
            theApp.enterEventDispatcher();
//          Logger.out("AppLaunch", "in the alternate entry point");
//          HttpFilterRegistry.registerFilter("www.google.co.in", "com.innominds.ca", false);
        }
    }

    public AppLaunch()
    {
        checkPermissions();
        showTestScreen();
    }

     /**
     * This method showcases the ability to check the current permissions for
     * the application. If the permissions are insufficient, the user will be
     * prompted to increase the level of permissions. You may want to restrict
     * permissions for the ApplicationPermissionsDemo.cod module beforehand in
     * order to demonstrate this sample effectively. This can be done in
     * Options/Advanced Options/Applications/(menu)Modules.Highlight
     * 'ApplicationPermissionsDemo' in the Modules list and select 'Edit
     * Permissions' from the menu.
     */
    private void checkPermissions()
    {

        ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
        ApplicationPermissions original = apm.getApplicationPermissions();

        if(original.getPermission(ApplicationPermissions.PERMISSION_BROWSER_FILTER) == ApplicationPermissions.VALUE_ALLOW)
        {
            // All of the necessary permissions are currently available
            return;
        }

        ApplicationPermissions permRequest = new ApplicationPermissions();
        permRequest.addPermission(ApplicationPermissions.PERMISSION_BROWSER_FILTER);

        boolean acceptance = ApplicationPermissionsManager.getInstance().invokePermissionsRequest(permRequest);

        if(acceptance)
        {
            // User has accepted all of the permissions
            return;
        }
        else
        {

        }
    }

    /**
     * Shows the test screen to allow the user to exercise the application
     * permissions capabilities.
     */
    private void showTestScreen()
    {
        UiApplication.getUiApplication().pushScreen(new AppLaunchScreen());
    }
}

can someone please help... Sorry for the almost total code display...

I was finally able to solve this problem. NPE is to come in other methods of recall because I'm implementation of the FilterBaseInterface.

Tags: BlackBerry Developers

Similar Questions

  • Configuration of the browser for blackBerry Smartphones - does not

    On older versions of blackberries, you go to browser > options > browser configuartion, but can someone tell me how to do it on the TORCH 9810, or can't you?...

    I have a problem with my internet, I connected to a wifi at home but its still using my mobile internet that comes from my contract that I have to change all the settings, but could you tell me some time how do I solve this problem I didn't ant to my use of the internet and to pay more

    On your home screen, click on manage connections > connections and networks > Mobile network.  Make sure that your data Services have the value IT.  Now, go back two screens and uncheck the Mobile network at the top.  In this way, you don't use all network data, but you will not receive also calls or texts.  If you leave your Mobile network connection on your BlackBerry should default to your Wi - Fi connection and should not use data from any network.

    I hope that helps you.

  • Open an application from a url + parameters

    Is it possible to open an application from a url with parameters and read these parameters?

    You can change the file descriptor real app, no need to hack the content of the IPA. In InfoAdditions, you need to add to CFBundleURLTypes. Read this article on how it should work:

    http://help.Adobe.com/en_US/air/build/WSfffb011ac560372f7e64a7f12cd2dd1867-8000.html

  • How do I open the browser web blackberry with a url given by a click of a button.

    Hi all

    I'm developing an application in which I want to open the browser web blackberry with a URL given using a click of a button. How can I do that. I use this code inside the earpiece button

    ' Public Sub fieldChanged (field field, int context) {}
    TODO self-generating method stub
    Private private = Browser.getDefaultSession ();
    browserSession.displayPage ("http://www.google.com");
    }

    What is a good way to do this? Please help me...

    Yes

  • Launch the browser on WiFi

    Try to launch the browser via Wi-Fi on a 8820 and having not much of chance.   Code looks like this:

    Private private = Browser.getDefaultSession ();

    browserSession.displayPage (url + "; interface = wifi");

    The browser launches, but insists on the use on board.

    I don't have this problem when calling direct http java app: adding '; interface wifi =' correctly routes the data via the WiFi network.  For example, it's very well:

    HttpConnection connection = (HttpConnection) Connector.open (url + "; interface = wifi");

    Is there anything else I need to do to force the browser to use wifi?

    Thank you

    Nurikabe, the link in your message is the appropriate way to open the BlackBerry Hotspot browser.

  • Problem with the screen size of my application in the emulator for BlackBerry 10

    Hello, I have a problem with the emulator for BlackBerry 10 and is as follows:

    When I run my application in the emulator waving, sounds good and all content is complete, however, when I run the application in the emulator for BlackBerry 10 soft looks as if she had a zoom very large level of predefined way and only see a part of the application.

    With controller emulator, I have changed the level of 70% zoom, but still does not work.

    Here, I'm posting two photos:

    One future half-assed answer

    var dpr = 1; // To set the meta on a real device to get 1:1 pixels
    
    if(typeof window.devicePixelRatio != 'undefined') // Does device support devicePixelRatio?
        {
        dpr = window.devicePixelRatio;
        }
    
    if(dpr) // Set up the right meta
        {
        var meta = document.createElement("meta");    meta.setAttribute('name','viewport');
    
        meta.setAttribute('content','initial-scale='+ (1/window.devicePixelRatio) + ',user-scalable=no');
        document.getElementsByTagName('head')[0].appendChild(meta); // Inject meta
        }
    

    This works perfectly, but must be placed in thethe document FIRST and foremost

    Live JS is used to avoid problems of library management

    It won't work in Wellington but works perfectly on all devices I've tried

    As mentioned in the code above just packaging needs in the script tags and setting very high index.html HTML code as you can get - right afteris my favorite before any CSS or JS place<p class="reply"> <p class="reply">There are extensions to this topic-injection of script, I like to keep my code clean</p>

  • How can I launch Adobe Reader, accept the end-user agreement, quit and re-launch the browser?

    How can I launch Adobe Reader.accept the end user agreement, quit and re-launch the browser?

    Go to Launchpad, find Adobe Reader, double-click it.

  • Unable to launch the browser

    Can someone help me fix this, I'm not able to launch the browser while trying to save EBS using openscript. His watch the error such that it is impossible to get a connection to the browser helper after 15 seconds.
    Please suggest how to solve this problem.

    Thanks in advance

    Hello

    Please open Internet Explore.
    Go to view-> toolbars and see if Oracle.OATS.OpenScript.IEToolBar.OpenScriptToolBar is enabled. If it is not checked so please check and then try to run and see if its working.
    If its checked, then please uncheck and then check it in again, and then try to run.

    Kind regards
    Rajesh

  • Muse cut the part left my site when resizing the window of the browser for anything whether it is less than the width of the page

    When you use centering nychtemerales, Muse cut the left side of my site when re the sizing of the window of the browser for anything less than the width of the page, this also happens on mobile devices.  How can I keep the page focused but have content basically left stop when resizing or viewing on a mobile screen? I don't want the edge of the page to disappear on smaller screens and when you use a smaller window. I do not want to resize the entire site at a lower resolution. Thanks in advancearbubaproblem.jpg

    If the left is cut, then you have designed offshore from the left of the page mode Design of Muse. The blue guides indicate the edge of the page and a margin guide on the page. Rule zero is the left edge of the page.

    The page is not admissible it will focus as long that the browser is wider than the page. Then, she left aligned (on point zero on the sovereign in design mode).

  • Are you aware of a possible bug in the version 3.6.23? In the browser, for example, "two /" appears with the slash through the 'o'. Is this a known bug? Thank you

    Are you aware of a possible bug in the version 3.6.23? In the browser, for example, "two /" appears with the slash through the 'o'. Is this a known bug?

    When the same text is seen in another browser, it is displayed correctly as "two."

    The same question is displayed on another computer.

    Thank you.

    Sounds that you use a font that supports ligatures (Palatino?).

  • Launch the browser from Java button click

    Hi guys,.

    Displays the first time, hoping that you guys can give me a steer. I am a novice at coding and am worried that I bit bigger I can chew!

    I have the code snippet within a program, that I am putting together, and is that when the user clicks on the button full screen 'fullScreenC1111', the app will launch a web page. I'm not very good with managers and that sort of thing, so if someone could please take a look at my code and I would like to know how to add the functionality, I would be really grateful. If that's the case elsewhere where I offer my apologies for the double post...

    class Cineberry extends net.rim.device.api.ui.UiApplication
    {
        public static void main(String[] args)
        {
            Cineberry instance = new Cineberry();
            instance.enterEventDispatcher();
        }
        public Cineberry()
        {
            pushScreen(new CountyList11());
        }
    }
    
    import net.rim.device.api.ui.*;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.ui.component.EditField;
    import net.rim.device.api.ui.component.ObjectChoiceField;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.Manager.*;
    import net.rim.blackberry.api.browser.Browser;
    import java.util.*;
    
    public class CountyList11 extends MainScreen
    {
    
            ButtonField btnCl111;
            ButtonField btnCl112;
            CustomButtonField fullscreenCl111;
    
      public CountyList11()
        {
    
            super();
    
            Bitmap HELLO_LOGO = Bitmap.getBitmapResource("cineberry.png");
            BitmapField helloBmpField = new BitmapField(HELLO_LOGO);
            add(helloBmpField);  
    
            LabelField applicationTitle = new LabelField("Cineberry Location List");
            setTitle(applicationTitle);
    
            add(new SeparatorField());
    
            RichTextField cineberryTextField = new RichTextField("Please Choose a County");
            add(cineberryTextField);
    
            add(new SeparatorField());
    
            add(new RichTextField(Field.NON_FOCUSABLE));
            fullscreenCl111 =  new CustomButtonField("Omniplex Carlow", CustomButtonField.FULLSCREEN, Field.FOCUSABLE);
    
            fullscreenCl111.browserSession.displayPage("http://www.google.ie/movies?hl=en&near=carlow&dq=omniplex+carlow&theater=omniplex&ei=OMHYS5GIBIj00gS...");
            add(fullscreenCl111);
    
            add(new SeparatorField());        
    
            btnCl111 = new ButtonField("Back To A - Z", ButtonField.CONSUME_CLICK | EditField.FIELD_HCENTER);
            btnCl111.setChangeListener(new ButtonListener2());
            add(btnCl111);
    
            btnCl112 = new ButtonField("Back To Home Screen", ButtonField.CONSUME_CLICK | EditField.FIELD_HCENTER);
            btnCl112.setChangeListener(new ButtonListener1());
            add(btnCl112);
    
        }
    
    }
    

    I know that I imported without doubt too many packages as well, but I can understand that at a later stage.

    Thanks in advance

    .. and here's a simple way to call the browser on the latest OS levels:

    Private browser = Browser.getDefaultSession ();
    browser.displayPage ("www.google.com");

  • ATT 8320 - launch the browser does not work

    8320 with v4.5.0.110

    I did have a problem with that on any other device, but I start the browser and close the app and it returns me to the Ribbon.  However, when I open the browser, the page I started to.

    On other devices, it opens the browser to the page.

    I have attached the device and this is what happens:

    Exit MyApplication (215)
    Net_rim_bb_browser_daemon (73) foreground
    Net_rim_bb_ribbon_app (80) foreground
    FocusHistory: Acquired Focus; Home screen App; Component net.rim.device.apps.internal.ribbon.launcher.RibbonIconField

    Here is the code I use the launch of the browser.  Maybe I should use System.exit (0)?

    BrowserSession browserSession = Browser.getDefaultSession();browserSession.displayPage(url);System.exit(0);
    

    Call the private showBrowser after displayPage.  This brings the browser to the forefront.

  • KDL-60NX720; Launched the browser WEB and TV BRICKS! 4 RED flashes and support does not work

    I had this KDL-60NX720 for about 4-5 years, solid as a rock. Rarely used TV Apps, hooked up to Roku and looked at from time to time of movies in 3D from NTS Network Sony TV APPs.

    Today, I went on television and launched WEB TV browser, BIG MISTAKE. The State of TV bar off for 5 minutes, so I decided to turn off the TV and went outside. Came back a few hours later and the TV is over BRICKED.

    Flashing lights RED (4 times, pauses, repetitions). Turns on for 2 seconds, then turns OFF, can't the factory reset. Same sequence of flashing. Uplift of my entertainment system all unplugged each HDMI cord and followed every possible diagnosis Voodoo that Sony has recommended.

    Called and chatted with support. Downloaded the firmware on USB and plugged into the back. Waited 30 minutes. Same question above. Now 4 hours later, my life is in disarray and the TV is dead. Live sports game is on Roku and cannot look at anything. It's the weekend, Sony support just went offline.

    Past $ 2500 on this TV. Now I think if Sony will be able to help, or carry this TV from the wall bracket and drive him to the technician that will require more than a new purchase.

    What do Sony?

    Thanks for sending the link to United States service centers. According to my note, I live in the Canada.

    And have already looked at service Canada, 3 of the 4 centres centres have some negative reviews on Google. Not sure if Sony addresses the quality of service to their partners as well.

    End of the road for another loyal customer of Sony and all of its network and friends/family. Too bad.

  • HP recovery mananger-is not able to launch the disk for the recovery partition check, why?

    Hello HP,.

    I had a problem with my hard drive. HP send me a new.

    I copy all the information for the new hard drive recovery, but I think that hp, Manager of recovery do not recognize the recovery partition.

    can you help me please?

    I was able to do the recovery from the computer disks in a safe mode. now I'm restoration of original image.

    just in case I can help someone.

  • Updated for FireFox 11 and I keep getting "compatibility check Add-on" when I launch the browser.

    I've just updated to FireFox 11 and whenever I run the browser, I get this annoying window that checks for compatibility of modules.

    I looked for solutions and have tried the following:
    1 remove several extension files in the profile folder.
    2 returning to about: config to disable the extension: checkcompatibility (is not here).

    None of them worked.

    Have you tried to delete the prefs.js file?

    What security (firewall, antivirus) software do you have?

    Some security software has features of virtualization that can cause protection problems and restoring files in the Firefox profile folder.

Maybe you are looking for

  • Kernel Panic after trying to restart Spotify

    I got a Kernel Panic after trying to restart Spotify. I just want to know, what software/hardware causing the Kernel Panic. Thank you! Mar 23 16:53:27 Feb 2016 Panic report *. panic (cpu 0 0xffffff800a3f076b appellant): "soclose: NOFDREF"@/Library/Ca

  • Upgrading from Windows Vista Home Premium at 8 - CPU does not support NX

    Hello I have Vista Home Premium (very probably OEM as it came with the PC) on a PC and I bought the upgrade license to Windows 8 Pro. I understand that it is in terms of the license transition, but here is my problem: The CPU does not support NX (and

  • ROXIO KEEP OPENING IN SAFE MODE

    My roxio DVD vhs keep opening in my safe mode, how can I fix

  • IPCC Enterprise 5.a Script question

    Hello I have a problem of script in an environment of IPCC Enterprise 5. 0a. What I need is: I want to have the option of specifying a particular agent I want to call by pressing numbers of the officers 'CDA' line. (Just like in the script of Agent2A

  • auth failure VLAN vs the VLAN

    Hi all What are the criteria for determining whether to use the local network VIRTUAL auth failure or the guest VLAN? What happens if a non - 802.1 x client connects to the port, tell a seller... 802. 1 x does not occur, then is he then comments cros