views:

34

answers:

1

Hello.

I wrote a simple BB app that does an HTTP Request and downloads some JSON encoded information. When I run it on the emulator with the ";deviceSide=true" after the URL it works OK. But when I tried it in my BlackBerry Storm actual device, I got the following exception:

java.io.IOException: No tunnels to open

Here's the code I use to do the HTTP Request:

public static String doHttpRequest(String addr) {
    HttpConnection hConn = null;
    DataInputStream dis = null;
    String strData = "";

    try {
        hConn = (HttpConnection)Connector.open( addr );
        dis = new DataInputStream(hConn.openInputStream());

        //Get the string in the stream
        int c;

        while ( (c = dis.read()) != -1 ) {
            strData = strData + (char) c;
        }
    }catch (Exception e) {
        net.rim.device.api.ui.component.Dialog.alert( e.toString() );
    } finally {
        try{
            if(dis != null) dis.close();
            if(hConn != null) hConn.close();
        } catch(Exception e) {
            net.rim.device.api.ui.component.Dialog.alert( e.toString() );
        }
    }

    return strData;
}
A: 

It seems you have some APN issues, you should reconfigure this part.

In general if your code works well on an emulator the chances are that your will need some configuration tweaks on your phone.


Resources :

Colin Hebert
Ok thanks. I will on another phone that I know have correctly configured APN's.
Edu