BrowserField2 + handleNavigationRequest + os6

Hi all

I want to replace the navigation in the browserfield I've done through the following code:

I just run the following code:

CFB BrowserFieldConfig = new BrowserFieldConfig();
bfc.setProperty (BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_CARET);
bfc.setProperty (BrowserFieldConfig.CONTROLLER, new BrowserFieldController() {}
public InputConnection handleResourceRequest (BrowserFieldRequest request) throws Exception {}
return (InputConnection) Connector.open (request.getURL ());
}
Public Sub handleNavigationRequest (BrowserFieldRequest request) throws Exception {}
Private b = Browser.getDefaultSession ();
b.displayPage (request.getURL ());
}
});
_bf2 = new BrowserField (CFB);

_SCREEN = new MainScreen();
_SCREEN. Add (_bf2);
pushScreen (_screen);
String browserText ="

Go to http://www.google.co.in/ \">Google

>";
_bf2.displaycontent (browserText, "");

My breakpoint in

handleNavigationRequest (..)

has been triggered by the present.  This suggests that it is possible to intercept it.  What you do in the handleNavigationRequest (.) belongs to you.  Memory, in similar circumstances, I open the external link, but also meet the navigationrequest by directing the BrowserField in html format that basically says - "you have been taken to... page in the external browser.  "

Tags: BlackBerry Developers

Similar Questions

  • Field Explorer events

    Hello

    There is no event or a way to catch by clicking on the links of browserfield?

    for example:

    
    

    This field of work browser call when click on it but I need to make custom my own links and how can I get it?

    Take a look at this Thread.

    http://supportforums.BlackBerry.com/T5/Java-development/BrowserField2-handleNavigationRequest-OS6/TD...

  • BrowserField2 help - page does not not (OS5)

    Hi all

    I'm new to the development of Blackberry, please go easy on me :-)

    I am trying to build a simple application to WebView, but some of the links need to open in the default browser instead of the application. I've got fine by using the command BrowserField2 of loading web pages, but when I try to replace all the ProtocolController, I get is the error "error calling content for. I can't find much in the way of complete examples, if anyone has any ideas what I am doing wrong?

    public final class MyScreen extends MainScreen
    {
        private BrowserField _browserField;
        private boolean _documentLoaded = false;
        private BrowserFieldRequest _request;
    
        public MyScreen()
        {
            ProtocolController myController = new MyProtocolController(_browserField);
    
            BrowserFieldConfig config = new BrowserFieldConfig();
    
            // Web page loads fine if you comment out this line
            config.setProperty(BrowserFieldConfig.CONTROLLER, myController);
    
            _browserField = new BrowserField(config);
            add(_browserField);
    
            try
            {
                _browserField.requestContent("http://www.google.com/");
            }
            catch(Exception e)
            {
                deleteAll();
                add(new LabelField("ERROR:\n\n"));
                add(new LabelField(e.getMessage()));
            }
        }
    
        public class MyProtocolController extends ProtocolController {
        public MyProtocolController(BrowserField browserField){super(browserField);
        }
    
        public InputConnection handleResourceRequest(BrowserFieldRequest request) throws Exception {
            return super.handleResourceRequest(request);
        }
        public void handleNavigationRequest(BrowserFieldRequest request) throws Exception {
            // TODO: check if link should open Blackberry browser, if not then allow page to load in BrowserFiled2
            super.handleNavigationRequest(request);
        }
        }
    }
    

    Thank you

    Tim

    solved my problem.

    It turns out that I tried to use _browserField before it was created in this line: -.

    ProtocolController myController = new MyProtocolController (_browserField);

    everything works now :-)

  • How upgrade to OS6?

    Hi guys,.

    I use air book Mac running OS 5.8. I have the USB of OS6 key but I can't install it open the application. Should I press something when you turn on the machine? Thank you.

    Hello

    I use air book Mac running OS 5.8.

    Do you mean OS X 10.5.8?

    I have the key USB of OS6

    This is OS X 10.6 (Snow Leopard)?

    So, if it's an installation drive of authentic, connected on the Macbook Air, and then start the computer by holding down the Option key. You can then select the installation disc.

  • OS6 improved ReadyNAS 3200 cable - USB DOES NOT

    So I've updated several different brands ReadyNAS units models and so far, everything is fine. However, I have a system mounted 3200 rack which has been upgraded, but will not recognize a USB key inserted into the rear USB (a port). I tried several approaches, including reformulating them with the installed USB. I reinstalled the upgrade. The light on the USB flashes quickly when I first install it, and then it stops flashing after a few seconds.

    The main reason I installed the upgrade, it's that I need to encrypt the volume, which requires the USB. The 'box' style ReadyNAS unit seems to work very well. It gives me headaches.

    I know that this is not a supported upgrade, but I need to find a way to make it work.

    Any ideas?

    Thank you.

    Scott

    I suspect that the system is looking for some paths hard-coded when looking USB key containing the encryption key, and these are not defined for the 3200 on OS6.

  • Mount iSCSI file in OS6 OS4

    I recently ran the upgrade of the community on my ReadyNAS Pro 6 for ReadyNas OS 6.

    I am running firmware 6.5.0 - T338.

    I know that my device is support, so I hope someone would be kind enough to help me out here.

    Of OS4, I supported files real iSCSI which are found in /c/.iscsi/* with the file ietd.conf in/etc.

    Upgrade to OS6, the iSCSI subsystem seems completely revamped, but I was hoping to get records of iSCSI to extract some data off them, or even to present as an iSCSI target to migrate data off them.

    If someone could provide a suggestion or some advice, I would really apprecaite it.

    I'm still open to running a Virtual Machine with ReadyNas OS4, if someone could tell me how to get there.

    Thank you.

    I think I have found a solution to my problem.

    I found a picture of the Raidiator 4.2.23 virtual box. to https://community.netgear.com/t5/Community-Add-ons/RAIDiator-x86-4-2-23-VirtualBox-image-notsupporte...

    Thanks to Kurdistan for the creation of this back in the day.

  • How to set iSCSI CHAP Username with OS6

    Hello.

    I upgraded my loan NAS Pro 4 to OS6 ready (thanks to Netgear, great support!) and want to use CHAP on my iSCSI on debian virtual computer connection. Before with OS4, I can put some user name with OS6 I don't find something to set it. Somewhere I must have missed the adjustment necessary.

    See you soon,.

    Nils

    Hi augur.

    The user name is the same as the name of the local initiator system defined by your initiator iSCSI or one known as IQN (name of the initiator). Try and tell me if it works.

    Kind regards

    BrianL
    NETGEAR community team

  • Invisible OS6 search result

    Hi all

    Simply play with Theme Studio 6, I created a theme for the Bold 9700 OS6 running

    Everything looks perfect, apart from a bug: when using universal search feature all the results are invisible! I am able to scroll down the 'blind' and click on a random outcome, but unable to see the icons, be they in short or not

    Any ideas what area of the topic, I changed to this break? Can't find it in Theme Studio for the life of me!

    See you soon
    Jim

    Is me... already arrived, it's a bug...

    It happened to me when I changed just Carret color back to default and ready...

  • I can't update the Smartphones from blackBerry bold 9700 to OS6

    I'm trying to update my bold 9700 OS6, but I can't.

    If you really want to update your device, I would say that do you a 'new' OS installation according to the following instructions:

    1. Use Desktop Manager to backup your device.
    2. Close the Desktop Manager and disconnect your device.
    3. Download an application on your computer called BBSAK (BlackBerry Swiss Army Knife). You use it to wipe the operating system of your device. You can get it here: www.bbsak.org
    4. Download the latest OS for your device, you can get here. https://swdownloads.BlackBerry.com/downloads/entry.do?code=9461CCE28EBE3E76FB4B931C35A169B0.------
    5. Connect your device to your PC and start BBSAK. It will ask you a password. If you don't have a game for your device, simply click OK.
    6. Choose the option to wipe device. Once completed, you will be left with a blank screen and an app 507 error, which means that the wipe has been a success.
    7. Unplug your unit.
    8. On your PC, navigate to C:\Program Files\Common research in Motion\AppLoader. Delete the file in the lower part called vendor.xml.
    9. Connect your device.
    10. In this same folder as shown above, there is an executable file called Loader (has a small telephone next to him). Double click on that and it will start loading your OS.

    You have to reinstall and 3rd party applications you have, keeping in mind that if you're under OS 5 now, some of your applications may not be not compatible with OS 6, in which case you will also need to update those which in addition to the resettlement.

    Please post back and let us know how it goes!

  • BUG: OS6 / JavaScript 'onclick' event when pulling ball control to help

    Hello

    I'm developing a web application targeting OS6 devices (torch and no key, for example Curve 9300). The problem is that an 'onclick' event does not fire when you use a Trackball to click on the object (torch and Curve 9300).

    It seems to be a bug (browser) OS6 as an "onmouseover" works without problem.

    ......
    
    var submitButton = document.getElementById('submit-button');submitButton.onclick = testOnClick;
    
    function testOnClick() {    alert('onclick never gets triggered by trackball, but when you touch the button it does!');}
    

    This causes a problem deploying the application to a mixed environment of OS6 devices.

    Someone else has a similar problem, or miss me something?

    Thank you

    Hi Sasha,

    I tried the code on the following simulators below:

    Torch 9800: 6.0.0.227, 6.0.0.246, 6.0.0.337

    Style 9670: 6.0.0.309

    NOTE: I couldn't find a simulator of 9300 with 6.0

    This code, everything seems to work properly on those built using the trackpad to move the pointer over the button and click it.

    Are maybe run you document.getElementById () in a script page that is not related to a document loaded event online?  I wonder if the purpose of the document is not yet loaded until you take a reference to it?

    
    
        
            
            Untitled Page
            
        
        
            
        
    
    
  • html5_init.js creates different behaviors of DB on OS5 and OS6! Help!

    Hello

    I am trying to create an application that runs on OS5 and OS6 and uses the html5_init.js scripts provided by RIM around the fact that os5 runs synchronously on gears and asynch OS6 on HTML5...

    After a lot of refactoring and rewrite, it remains now to the next obstacle. On OS5, it works as I hope as follows BUT on OS6 it doesn't, it behaves quite differently

    Example, I create an array of objects and itterate over them and insert them into a table of test.

    function insertTestData() {
        db.transaction(function(tx) {
            var testData = [];
            for (var i = 0; i < 3; i++) {
                var testCodeValue = new Object();
                testCodeValue.code = "code" + i.toString();
                testCodeValue.value = "value" + i.toString();
                testData.push(testCodeValue);
            }
    
            for (var y = 0; y < testData.length; y++) {
                var code = testData[y].code;
                var value = testData[y].value;
    
                alert(code);
                alert(value);
    
                tx.executeSql("INSERT INTO test(code,value) VALUES (?,?)", [code, value], rowInserted, function(tx, err) { alert("Error!"); });
            }
        });
    }
    

    the end result is:

    Hello

    Check out this post on loops in transactions for the asynchronous callbacks. He can help out you.

    for loops

    See you soon

    Andrew

  • API of Communication OS6 no Msg Push

    I'm just trying to provide 2 versions diff to push Clients:

    * OS 5 customer (based on the sample of push and Simon_Hains code example)

    works well

    * OS 6 Client using the new API of Communication Communication API demo

    Subscription to the content provider and recording of BPS works well: questioning the BPS, the customer is active

    Removal of the device APP automatically off records the PIN of the BPS Server

    The SubscriptionResponseListener works as well: onMessage receives the response from the ContentServer to verify if the subscription is allowed.

    But: the MessageListener for PushMessages of BPS gets no message. The messages will become "EXPIRE" after a while because of the delivery-before-timestamp...

    The Messages were repelled EVAL Push server if you use the OS5 - sample of push.

    also if PushSample is running and you try to run also the OS6 push Cklient I have the correct message that another receiver is already listening on the Port.

    think there must be something wrong with my receiver not to receive Messages - maybe the URI of the receiver is listening on:

    BPS_PUSH_RECEIVER_URI = ' local: / /: "+ BPS_PUSH_PORT".

    the JavaDoc says:

    createNonBlockingReceiverDestination will receive the messages by listening to the local://deviceAppName URL.

    the API of Communication demo uses:

    local: / /:tro-No./test2

    I also tried to add the receiver URI/name-of-cod, but it's the same: no message coming

    any ideas what could be the problem?

    GOD wrote:

    ...

    think there must be something wrong with my receiver not to receive Messages - maybe the URI of the receiver is listening on:

    BPS_PUSH_RECEIVER_URI = ' local: / /: "+ BPS_PUSH_PORT".

    the JavaDoc says:

    createNonBlockingReceiverDestination will receive the messages by listening to the local://deviceAppName URL.

    the API of Communication demo uses:

    local: / /:tro-No./test2

    thx for helping RIM on that: a ' / ' missing

    This is the URI of the BPSPushReceiver of the OS 6 Communication API is listening on:

    "local: / /:" + BPS_PUSH_PORT +"/" ".

  • FieldChangeListener does not not in OS6

    I have the following listener to perform an action to a button click event.  It works very well in OS5 devices, but nothing happens when you click the button in the OS6 devices.  Any ideas?

    ButtonField buttonSearch = new ButtonField("Search", ButtonField.CONSUME_CLICK)
            {
                public int getPreferredWidth()
                {
                    return Display.getWidth();
                }
            };
            FieldChangeListener listener = new FieldChangeListener() {
                public void fieldChanged(Field field, int context) {
                    final AddressInfo addrInfo = new AddressInfo();
    
                        addrInfo.setField(AddressInfo.STREET, street.toString());
                        addrInfo.setField(AddressInfo.CITY, city.toString());
                        addrInfo.setField(AddressInfo.STATE, state.toString());
                        addrInfo.setField(AddressInfo.POSTAL_CODE, postal.toString());
                        addrInfo.setField(AddressInfo.COUNTRY, "United States");
                    geoCache(addrInfo);
                }
            };
            buttonSearch.setChangeListener(listener);
            add(buttonSearch);
    

    try to use this code: I use it on OS 6.0

    class xxxxxx extends MainScreen implements FieldChangeListener{    xxxxxx()    {        ButtonField buttonSearch = new ButtonField("Search", ButtonField.CONSUME_CLICK);        buttonSearch.setChangeListener(this);    }
    
        public void fieldChanged(Field field, int context)     {        if (field == buttonSearch)         {        }    }}
    
  • Question of size BrowserField2 displayContent fonts

    We are calling BrowserField2.displayContent (String, String) and passing in HTML. On 5.0.0 police find normal, but on 6.0.0 it is very large. I checked the zoomScale on both and they are 1.0f. I checked the size of the BrowserField and the Manager holding it, and it's the size of the screen.

    The HTML being passed is simple:

    Hello

    Hi Martin,

    The engine WebKit of BlackBerry 6 requires to provide you with a good window tag, instead of setting the virtual viewport using the browserField.zoomScale property:

    
    
    
    
    Hello
    

    hope that helps,

    Sincerely,
    Adam

  • OS6 Communication fails with HTTP BIS - b

    Hello

    in an application OS6 I met a problem that cost me some time to find out the reason:

    HTTP GET or POST fail on connections of BIS_B using the OS6 Communication APIs - I have not found a way to make it work, so falling to OS5 network API

    Here is the story:

    a very simple scenario: send something via HTTP to a server and the server sends back a small stream. ("text/plain")

    well... you can take a look at the "Communication API demo of OS6 samples to see what should be possible using the OS6 Communication APIs

    at first I tried Simulator: all works well using blocking or NonBlockingSenderDestinations.

    the tried on a device:

    WIFI: it works the same as on the Simulator + MDSCS

    Cell TCP: works the same as on the Simulator

    BISB: FAILS - is not serious if you use GET or POST or using blocking or NonBlocking destinations

    same URL entry browser: it works well, sending text server of displayed well

    strengthened through the code being debugged, added logging statements and eventually found what happened:

    TransportHeaders respose message were different.

    It's the Transportheader using WIFI, cellular TCP, Simulator + MDSCS coming:

    Content-Type

    text/plain; charset = utf-8

    Content-Length

    19

    Connection

    close

    Server

    Jetty (6.1.x)

    was exactly what we expected: raw text of length 19 sent my Pier OSGI server.

    Now take a look at the coming of TransportHeaders rear using BISB on device (9800):

    connection

    close

    Server

    Jetty (6.1.x)

    content length

    78

    x-rim-etag

    'B93405A8E587FE3E45F4210D41D1A1218E7DE4C5 '.

    x-rim-bsm-session

    None

    x-cache-search

    MISS Blackberry.Internet.Browsing.Service:3128

    through the

    1.1 pmds95.bisb4.blackberry:3128 (squid/2.7.STABLE7)

    content type

    application/vnd. RIM.html

    x cache

    MISS Blackberry.Internet.Browsing.Service

    the server threw and the connection is closed - what is the same and correct.

    the other TransportHeaders lead me to think that maybe it was how the content was transported through the BlackBerry infrastructure, but I forgot to convert what needs to be given to the customer.

    I analyzed the byte [length] 78 and found this inside this table as my 19 bytes sent from the server were found and the byte before this text was a byte of value ' 19 '' - the length of the following data. " I also found "text/plain" isnide table.

    I should put some headers more to my side Server?

    But he couldn't be that bad because by using the APIs network OS5 it is correctly by the device BISB. the code was similar.

    Here's the (simplified) OS6 code for aNonBlockingSenderDestination:

    NonBlockingSenderDestination subscribeDestination = null;
    ConnectionFactory cf = new ConnectionFactory();
    cf.setPreferredTransportTypes(new int[]{
        TransportInfo.TRANSPORT_TCP_WIFI,
        TransportInfo.TRANSPORT_MDS,
        TransportInfo.TRANSPORT_BIS_B,
        TransportInfo.TRANSPORT_TCP_CELLULAR,
        TransportInfo.TRANSPORT_WAP2
    });
    BisBOptions biso = new BisBOptions(seekretConnectionType);
    cf.setTransportTypeOptions(TransportInfo.TRANSPORT_BIS_B, biso);
    Context subscribeContext = new Context("SUBSCRIBE_NON_BLOCKING", cf );
    try {
          subscribeDestination = (NonBlockingSenderDestination)DestinationFactory
            .getSenderDestination(
                subscribeContext.getName(),
                getPushInitiatorSubscribeURI());
          if (subscribeDestination == null) {
             MessageListener subscriptionListener = new SubscriptionResponseListener("Subscription");
                subscribeDestination = DestinationFactory
                    .createNonBlockingSenderDestination(
                        subscribeContext,
                        getPushInitiatorSubscribeURI(),
                        subscriptionListener
                    );
          ConnectionDescriptor connectionDescriptor =   subscribeContext.getConnectionFactory().getConnection(getPushInitiatorSubscribeURL());
          HttpMessage httpMessage = (HttpMessage) subscribeDestination.createByteMessage();
          httpMessage.setMethod(HttpMessage.POST);
          subscribeDestination.send((Message)httpMessage);
    

    and here's the code API network OS5 (Simplified):

    DataBuffer buffer = new DataBuffer( 256, false );
    InputStream is = null;
    Connection conn = null;
    try {
        ConnectionFactory cf = new ConnectionFactory();
        cf.setPreferredTransportTypes(new int[]{
            TransportInfo.TRANSPORT_TCP_WIFI,
            TransportInfo.TRANSPORT_MDS,
            TransportInfo.TRANSPORT_BIS_B,
            TransportInfo.TRANSPORT_TCP_CELLULAR,
            TransportInfo.TRANSPORT_WAP2});
        BisBOptions biso = new BisBOptions(seekretConnectionType);
        cf.setTransportTypeOptions(TransportInfo.TRANSPORT_BIS_B, biso);
        ConnectionDescriptor connectionDescriptor = cf.getConnection(getPushInitiatorSubscribeURL());
        conn = (HttpConnection) connectionDescriptor.getConnection();
        if( conn instanceof HttpConnection ) {
             HttpConnection httpConn = (HttpConnection) conn;
             ((HttpConnection) conn).setRequestMethod(HttpConnection.POST);
             OutputStream os = httpConn.openOutputStream();
             os.write(("user="+user+";pw="+password).getBytes());
             os.flush();
             int responseCode = httpConn.getResponseCode();
             is = httpConn.openInputStream();
             int length = is.read( buffer.getArray() );
             buffer.setLength( length );
             String response = new String( buffer.getArray(), buffer.getArrayStart(), buffer.getArrayLength() );
             if( responseCode == 200 ) {
                  return true;
             }
        }
    

    is similar using always the same values and the server gets the correct data even from BISB using the Communication APIs - just the answer for this type of transport passing becomes bad.

    any ideas?

    or should I proceed to report a problem as a Bug?

    There is really a bug: If you use BISB with HTTP and OS 6 Communication API, then:

    It works for BISB-over-WIFI

    but it fails to BISB-over-carrier

    bug in > 6.0

    The GOOD NEWS: there is a solution:

    Just add a "User-Agent" TransportHeader with any value to your HTTP request Message, but the value does NOT start with the word "BlackBerry".

    then it works always - is not serious if the transport is in WIFI or carrier

    RIM thx for help

Maybe you are looking for