CoverageInfo

Why the CoverageInfo.COVERAGE_CARRIER JDE API 4.3 replace by CoverageInfo.COVERAGE_DIRECT JDE, 4 as the two flag has the same value and having the same use. Can tell the difference between them

no difference, I think that RIM I just wanted to use a better name

Tags: BlackBerry Developers

Similar Questions

  • CoverageInfo.isCoverageSufficient (CoverageInfo.COVERAGE_MDS) always returns false on Simulator

    Hello world

    In my application, I would like to send data on a certain interval using the BES (MDS).  When the Blackberry is on the cover, I send the data right away... but when the Blackberry is out of coverage, I'm storing data on the PersistentStore and send it to the next interval.

    This is the condition that I use to determine whether or not the Blackberry is on the cover:

    {If ((RadioInfo.getState ()! = RadioInfo.STATE_OFF & (RadioInfo.getNetworkService () & RadioInfo.NETWORK_SERVICE_DATA)! = 0) & {CoverageInfo.isCoverageSufficient (CoverageInfo.COVERAGE_MDS))}

    It works perfectly on a real device Blackberry... but it always returns false on the Simulator (I tried Curve 8310 Rogers and 8330 Curve with my code point 4.2.1).)  It seems to be this specific line which is not correct:

    CoverageInfo.isCoverageSufficient (CoverageInfo.COVERAGE_MDS)

    It is not a very big problem because it works on a real device... it's just development and debugging more complicated as I have to remember to put this line in the comments when you use the Simulator and remove the comments before installing the application on a real device.

    I have to do something special on the Simulator to enable this?  Or is it a problem with my code?

    Thanks for your help!

    I saw that too. Put the CoverageInfo into your own method and use DeviceInfo.isSimulator () to work around the call and returns "true" If you run on the simultor.

  • CoverageInfo.getCoverageStatus () return codes.

    Test app with OS 4.2.1-> 4.7 on the 9xxx 83xx and 88xx models

    How can I find a list of the return codes for the COVERAGE_MDS | COVERAGE_DIRECT | Constant COVERAGE_NONE in CoverageInfo?

    Read the posts only I found related to this, Mark and Richard mentioned tips, but nothing about the codes that are returned.

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=3336&query.ID=307...

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&message.ID=13959&query.ID=30...

    This line of code:

    mds_num = CoverageInfo.getCoverageStatus(CoverageInfo.COVERAGE_MDS,false);
    

    I get:

    7 if the device is turned on on BES

    5 if it is not connected to a BES, but he has a data plan with the carrier

    0 using 8800 by MDS Simulator Simulator.

    I'm looking to complete a login code.

    Anyone know the rest of the codes I have to deal with?

    In addition, in the first thread that precedes it is stated that the call to getCoverageStatus with and without params returns different results.

    I think that it is because he calls without a WAF stated simply back the more optimistic code? Which means that if one of the WAFs is on the cover, it returns 7? The list of codes would help for debugging, I think.

    Thank you.

    kkraliz,

    You call the method with wrong arguments. You are passing COVERAGE_MDS as the first paramether, whereas the method expects one of the RadioInfo.WAF_* values.

    I think that you test this on a CDMA phone and values WAF_CDMA == COVERAGE_MDS. If you get the expected results.

    The return values will be the combination of the CoverageInfo.COVERAGE_* values.

    Then

    0 - No Coveage
    5 - COVERAGE_BIS | COVERAGE_CARRIER  ( 4 | 1)
    7 - COVERAGE_BIS | COVERAGE_MDS | COVERAGE_CARRIER ( 4 | 2 | 1)
    
  • CoverageInfo.isCoverageSufficient (CoverageInfo.COVERAGE_CARRIER) exception thrown

    Hello

    I use CoverageInfo.isCoverageSufficient (CoverageInfo.COVERAGE_CARRIER) to see "Network data connection" ON or OFF. Sometimes this method works, but sometimes it throws special suite. I am running my app on BlackBerry 8320 with OS 4.2.2.180 device and platform version is 2.5.0.36.

    Name: UnsupportedOperationException
    GUID: 9c3cd62e3320b498
    Time: October 27, 2008 16:53:46
    No detail message
    net_rim_cldc-5
    CoverageInfo
    isCoverageSufficient
    0x6E95
    net_rim_cldc-5
    CoverageInfo
    isCoverageSufficient
    0x6E72

    Please help me solve the problem.

    Thank you

    That sounds right.  It seems to happen randomly.

  • Cost of connection and CoverageInfo

    Hello

    I do the experiments with catches of Blackberry and the various parameters to set up the connetcion.

    Moreover, I am trying to connect by using different settings according to the State of CoverageInfo (COVERAGE_BIS_B, COVERAGE_DIRECT, COVERAGE_MDS).

    Specifically what I want to know is if connect via any kind of channels has a different impact on the cost of connection.

    Thank you

    Welcome to the forums.

    I think that the cost of connection will be different on different media for different methods.

    There's a door that offer unlimited access to data while other charges per MB.

    I know that bis_b would use WiFi if possible before using the services of the door. So maybe it's better to use. I also think you have to be a BlackBerry partner in order to use the BIS, but I don't know if it is still in effect for 5.0 OS and later using the new APIs. A person from RIM will confirm that.

  • CoverageInfo behaves different OS > = 4.7

    I found that the CoverageInfo class produced different results on the new BlackBerry OS (4.7, 5.0), according to the JDE used to compile the application.

    Try to compile this piece of code for JDE 4.5 and run on a BIS device with compatible OS > = 4.7 (Storm, Storm 2, Bold 2)...:

    int status = CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_BIS_B;
    if(status == 0){
        System.out.println("No BIS Coverage");
    } else {
        System.out.println("Coverage OK");
    }
    

    Now compile it for a new OS (> = 4.7) and test it again on the same device. Surprised?

    I think that it is a serious problem, because this control is useful for determining if a BIS device has enough coverage to make connections.
    I have not tested CoverageInfo.COVERAGE_MDS yet because I don't have any active BES device available at the moment, but I suspect that the same thing can happen.

    I found that the problem was on getCoverageStatus, which behaves different from isCoverageSufficient. I replaced this line and now it works. Thanks to kyublin on this post for the discovery.

  • Coverageinfo works with simulators?

    I would like to know if the user has a cover when I run my bberry application.  Does

    CoverageInfo.getCoverageStatus () to work when you test simulators?  (If I kill the mds - cs, he always says I have a direct connection).

    Also is it possible to set the value of timeout for HttpConnection?

    Thank you

    Gerry

    No, it doesn't. What you can do is to put a line of code in there to call DeviceInfo.isSimulator () and return a value you want to see in the Simulator.

    In other words, have your own fundtion of the utility 'hasCoverage()' (or something like that) and place the "isSimulator()" in this control. If not the Simulator, then return the value of CoverageInfo.

  • Application does not work without wifi connection

    Hello I have a problem with the http connection

    my code is

    public class HttpConnectionFactory
    {
    
        /**
         * Specifies that only wifi should be used
         */
        public static final int TRANSPORT_WIFI = 1;
    
        /**
         * Specifies that only BES (also known as MDS or corporate servers)
         */
        public static final int TRANSPORT_BES = 2;
    
        /**
         * Specifies that only BIS should be used (Basically RIM hosted BES)
         */
        public static final int TRANSPORT_BIS = 4;
    
        /**
         * Specifies that TCP should be used (carrier transport)
         */
        public static final int TRANSPORT_DIRECT_TCP = 8;
    
        /**
         * Specifies that WAP2 should be used (carrier transport)
         */
        public static final int TRANSPORT_WAP2 = 16;
    
        /**
         * Equivalent to: TRANSPORT_WIFI | TRANSPORT_BES | TRANSPORT_BIS |
         * TRANSPORT_DIRECT_TCP | TRANSPORT_WAP2
         */
        public static final int TRANSPORTS_ANY = TRANSPORT_WIFI | TRANSPORT_BES
                | TRANSPORT_BIS | TRANSPORT_DIRECT_TCP | TRANSPORT_WAP2;
    
        /**
         * Equivalent to: TRANSPORT_WIFI | TRANSPORT_BES | TRANSPORT_BIS
         */
        public static final int TRANSPORTS_AVOID_CARRIER = TRANSPORT_WIFI
                | TRANSPORT_BES | TRANSPORT_BIS;
    
        /**
         * Equivalent to: TRANSPORT_DIRECT_TCP | TRANSPORT_WAP2
         */
        public static final int TRANSPORTS_CARRIER_ONLY = TRANSPORT_DIRECT_TCP
                | TRANSPORT_WAP2;
    
        /**
         * The default order in which selected transports will be attempted
         *
         */
        public static final int DEFAULT_TRANSPORT_ORDER[] = { // TRANSPORT_DIRECT_TCP
        // ,TRANSPORT_WAP2
                TRANSPORT_WIFI,
                // TRANSPORT_BES, TRANSPORT_BIS,
                // TRANSPORT_WAP2,
                TRANSPORT_DIRECT_TCP };
    
        private static final int TRANSPORT_COUNT = DEFAULT_TRANSPORT_ORDER.length;
    
        private static ServiceRecord srMDS[], srBIS[], srWAP2[], srWiFi[];
        private static boolean serviceRecordsLoaded = false;
    
        private int curIndex = 0;
        private int curSubIndex = 0;
        // private String url;
        private final String extraParameters;
        private final int transports[];
        private int lastTransport = 0;
    
        /**
         * Equivalent to
         * HttpConnectionFactory( url, null, HttpConnectionFactory.DEFAULT_TRANSPORT_ORDER )
         *
         * @see #HttpConnectionFactory(String, String, int[])
         * @param url
         *            See {@link #HttpConnectionFactory(String, String, int[])}
         */
        public HttpConnectionFactory() {
            this(null, 0);
        }
    
        /**
         * Equivalent to
         * HttpConnectionFactory( url, null, allowedTransports )
         *
         * @see #HttpConnectionFactory(String, String, int)
         * @param url
         *            See {@link #HttpConnectionFactory(String, String, int)}
         * @param allowedTransports
         *            See {@link #HttpConnectionFactory(String, String, int)}
         */
        public HttpConnectionFactory(int allowedTransports) {
            this(null, allowedTransports);
        }
        public HttpConnectionFactory(int transportPriority[]) {
            this(null, transportPriority);
        }
    
        public HttpConnectionFactory(String extraParameters, int allowedTransports) {
            this(extraParameters, transportMaskToArray(allowedTransports));
        }
        public HttpConnectionFactory(String extraParameters,
                int transportPriority[]) {
            if (!serviceRecordsLoaded) {
                loadServiceBooks(false);
            }
            //
            // if (url == null) {
            // throw new IllegalArgumentException("Null URL passed in");
            // }
            // if (!url.toLowerCase().startsWith("http")) {
            // throw new IllegalArgumentException("URL not http or https");
            // }
            //
            // this.url = url;
            this.extraParameters = extraParameters;
            transports = transportPriority;
        }
        public Connection getNextConnection(String url)
                throws NoMoreTransportsException {
            Connection con = null;
            int countsWap = 0;
            int countsBis = 0;
            int countsBes = 0;
            int curTransport = 0;
            while (con == null && curIndex < transports.length) {
                System.out.println("con=" + con + " curid=" + curIndex);
                curTransport = transports[curIndex];
                switch (curTransport) {
                case TRANSPORT_WIFI:
                    curIndex++;
                    curSubIndex = 0;
                    try {
                        con = getWifiConnection(url);
                    } catch (Exception e) {
                    }
                    break;
                case TRANSPORT_BES:
                    curIndex++;
                    curSubIndex = 0;
                    try {
                        if (countsBes > 3) {
                            throw new NoMoreTransportsException();
                        }
                        con = getBesConnection(url);
                        countsBes++;
                    } catch (Exception e) {
                    }
                    break;
                case TRANSPORT_BIS:
                    while (con == null) {
                        try {
                            if (countsBis > 3) {
                                throw new NoMoreTransportsException();
                            }
                            con = getBisConnection(url, curSubIndex);
                            countsBis++;
                        } catch (NoMoreTransportsException e) {
                            curIndex++;
                            curSubIndex = 0;
                            break;
                        } catch (Exception e) {
                        }
                    }
                    break;
                case TRANSPORT_DIRECT_TCP:
                    curIndex++;
                    try {
                        con = getTcpConnection(url);
                    } catch (Exception e) {
                    }
                    break;
                case TRANSPORT_WAP2:
                    while (con == null)
                    {
                        // try {
                        // if (countsWap > 3) {
                        // throw new NoMoreTransportsException();
                        // }
                        // // con = getWap2Connection(url, curSubIndex);
                        // countsWap++;
                        // } catch (NoMoreTransportsException e) {
                        // curIndex++;
                        // curSubIndex = 0;
                        // break;
                        // } catch (Exception e) {
                        // }
                    }
                    break;
                }
            }
            if (con == null) {
                throw new NoMoreTransportsException();
            }
    
            lastTransport = curTransport;
            return con;
        }
    
        public Connection getCurrentConnection(String url)
                throws NoMoreTransportsException {
            Connection con = null;
            switch (lastTransport) {
            case TRANSPORT_WIFI:
                try {
                    con = getWifiConnection(url);
                } catch (Exception e) {
                }
                break;
            case TRANSPORT_BES:
                try {
                    con = getBesConnection(url);
                } catch (Exception e) {
                }
                break;
            case TRANSPORT_BIS:
                while (con == null) {
                    try {
                        con = getBisConnection(url, curSubIndex);
                    } catch (NoMoreTransportsException e) {
                        break;
                    } catch (Exception e) {
                    }
                }
                break;
            case TRANSPORT_DIRECT_TCP:
                try {
                    con = getTcpConnection(url);
                } catch (Exception e) {
                }
                break;
            case TRANSPORT_WAP2:
                while (con == null) {
                    try {
                        con = getWap2Connection(url, curSubIndex);
                        System.out.println("" + con);
                    } catch (NoMoreTransportsException e) {
                        break;
                    } catch (Exception e) {
                    }
                }
                break;
            }
    
            return con;
        }
    
        /**
         * Returns the transport used in the connection last returned via
         * {@link #getNextConnection()}
         *
         * @return the transport used in the connection last returned via
         *         {@link #getNextConnection()} or 0 if none
         */
        public int getLastTransport() {
            return lastTransport;
        }
    
        /**
         * Generates a connection using the BIS transport if available
         *
         * @param index
         *            The index of the service book to use
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws NoMoreTransportsException
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getBisConnection(String url, int index)
                throws NoMoreTransportsException, IOException {
            System.out.println("BIS Try");
            if (index >= srBIS.length) {
                throw new NoMoreTransportsException("Out of BIS transports");
            }
            ServiceRecord sr = srBIS[index];
            return getConnection(url, ";deviceside=false;connectionUID=", sr
                    .getUid());
        }
    
        /**
         * Generates a connection using the BES transport if available
         *
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getBesConnection(String url) throws IOException {
            System.out.println("BES try");
            if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS)) {
                return getConnection(url, ";deviceside=false", null);
            }
            return null;
        }
    
        /**
         * Generates a connection using the WIFI transport if available
         *
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getWifiConnection(String url) throws IOException {
            System.out.println("wifi try");
            // if (RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN)
            // && (RadioInfo.getActiveWAFs() & RadioInfo.WAF_WLAN) != 0
            // && CoverageInfo.isCoverageSufficient(1 /*
            // * CoverageInfo.COVERAGE_DIRECT
            // */,
            // RadioInfo.WAF_WLAN, false)) {
            //
            // return getConnection(";deviceside=true;interface=wifi", null);
            // // return getConnection(";deviceside=true;interface=wifi", null);
            //
            // }
            // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED
                    && srWiFi.length > 0) {
                return getConnection(url, ";interface=wifi", null);
            }
            return null;
        }
    
        /**
         * Generates a connection using the WAP2 transport if available
         *
         * @param index
         *            The index of the service book to use
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws NoMoreTransportsException
         *             if index is outside the range of available service books
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getWap2Connection(String url, int index)
                throws NoMoreTransportsException, IOException {
            System.out.println("WAP2 try");
            if (index >= srWAP2.length) {
                throw new NoMoreTransportsException("Out of WAP2 transports");
            }
            if (CoverageInfo
                    .isCoverageSufficient(1 /* CoverageInfo.COVERAGE_DIRECT */)) {
                ServiceRecord sr = srWAP2[index];
                return getConnection(url, ";ConnectionUID=", sr.getUid());
            }
            return null;
        }
    
        /**
         * Generates a connection using the TCP transport if available
         *
         * @return An {@link HttpConnection} if this transport is available,
         *         otherwise null
         * @throws IOException
         *             throws exceptions generated by {@link getConnection( String
         *             transportExtras1, String transportExtras2 )}
         */
        private Connection getTcpConnection(String url) throws IOException {
            System.out.println("direct try");
            if (CoverageInfo
                    .isCoverageSufficient(1 /* CoverageInfo.COVERAGE_DIRECT */)) {
                String extraParameter = null;
                if (!DeviceInfo.isSimulator()) {
                    url = url + ";deviceside=true";
                }
    
                return getConnection(url, null, null);
                // ";deviceside=true", null);
            }
            return null;
        }
    
        /**
         * Utility method for actually getting a connection using whatever transport
         * arguments the transport may need
         *
         * @param transportExtras1
         *            If not null will be concatenated onto the end of the
         *            {@link url}
         * @param transportExtras2
         *            If not null will be concatenated onto the end of {@link url}
         *            after transportExtras1
         * @return An {@link HttpConnection} built using the url and transport
         *         settings provided
         * @throws IOException
         *             any exceptions thrown by {@link Connector.open( String name
         *             )}
         */
        private Connection getConnection(String url, String transportExtras1,
                String transportExtras2) throws IOException {
            StringBuffer fullUrl = new StringBuffer();
            fullUrl.append(url);
            if (transportExtras1 != null) {
                fullUrl.append(transportExtras1);
            }
            if (transportExtras2 != null) {
                fullUrl.append(transportExtras2);
            }
            if (extraParameters != null) {
                fullUrl.append(extraParameters);
            }
            // fullUrl.append(";ConnectionTimeout=5000");
            System.out.println(fullUrl.toString());
            return Connector.open(fullUrl.toString(), Connector.READ_WRITE, true);
        }
    
        /**
         * Public method used to reload service books for whatever reason (though I
         * can't think of any)
         */
        public static void reloadServiceBooks() {
            loadServiceBooks(true);
        }
    
        /**
         * Loads all pertinent service books into local variables for later use.
         * Called upon first instantiation of the class and upload {@link
         * reloadServiceBooks()}
         *
         * @param reload
         *            Whether to force a reload even if they've already been loaded.
         */
        private static synchronized void loadServiceBooks(boolean reload) {
            if (serviceRecordsLoaded && !reload) {
                return;
            }
            ServiceBook sb = ServiceBook.getSB();
            ServiceRecord[] records = sb.getRecords();
            Vector mdsVec = new Vector();
            Vector bisVec = new Vector();
            Vector wap2Vec = new Vector();
            Vector wifiVec = new Vector();
    
            if (!serviceRecordsLoaded) {
                for (int i = 0; i < records.length; i++) {
                    ServiceRecord myRecord = records[i];
                    String cid, uid;
                    // sometimes service record is disabled but works
                    if (myRecord.isValid() /* && !myRecord.isDisabled() */) {
                        cid = myRecord.getCid().toLowerCase();
                        uid = myRecord.getUid().toLowerCase();
                        // BIS
                        if (cid.indexOf("ippp") != -1 && uid.indexOf("gpmds") != -1) {
                            bisVec.addElement(myRecord);
                        }
                        // WAP1.0: Not implemented.
    
                        // BES
                        if (cid.indexOf("ippp") != -1 && uid.indexOf("gpmds") == -1) {
                            mdsVec.addElement(myRecord);
                        }
                        // WiFi
                        if (cid.indexOf("wptcp") != -1 && uid.indexOf("wifi") != -1) {
                            wifiVec.addElement(myRecord);
                        }
                        // Wap2
                        if (cid.indexOf("wptcp") != -1 && uid.indexOf("wap2") != -1) {
                            wap2Vec.addElement(myRecord);
                        }
                    }
                }
                srMDS = new ServiceRecord[mdsVec.size()];
                mdsVec.copyInto(srMDS);
                mdsVec.removeAllElements();
                mdsVec = null;
    
                srBIS = new ServiceRecord[bisVec.size()];
                bisVec.copyInto(srBIS);
                bisVec.removeAllElements();
                bisVec = null;
    
                srWAP2 = new ServiceRecord[wap2Vec.size()];
                wap2Vec.copyInto(srWAP2);
                wap2Vec.removeAllElements();
                wap2Vec = null;
    
                srWiFi = new ServiceRecord[wifiVec.size()];
                wifiVec.copyInto(srWiFi);
                wifiVec.removeAllElements();
                wifiVec = null;
    
                serviceRecordsLoaded = true;
            }
        }
    
        /**
         * Utility methd for converting a mask of transports into an array of
         * transports in default order
         *
         * @param mask
         *            ORed collection of masks, example:
         *            TRANSPORT_WIFI | TRANSPORT_BES
         * @return an array of the transports specified in mask in default order,
         *         example: { TRANSPORT_WIFI, TRANSPORT_BES }
         */
        private static int[] transportMaskToArray(int mask) {
            if (mask == 0) {
                mask = TRANSPORTS_ANY;
            }
            int numTransports = 0;
            for (int i = 0; i < TRANSPORT_COUNT; i++) {
                if ((DEFAULT_TRANSPORT_ORDER[i] & mask) != 0) {
                    numTransports++;
                }
            }
            int transports[] = new int[numTransports];
            int index = 0;
            for (int i = 0; i < TRANSPORT_COUNT; i++) {
                if ((DEFAULT_TRANSPORT_ORDER[i] & mask) != 0) {
                    transports[index++] = DEFAULT_TRANSPORT_ORDER[i];
                }
            }
            return transports;
        }
    }
    

    HIII, I use this class to call http to the server, but each time that gives the error No more TransportsException
    application only works on wifi
    I try both GET and POST nothing worked

    device: = 8520 os 5.0
    BIS service provider:-vodaphone plan 15/day
    in that gtalk and facebook works fine

    also I test this app in Arabic countries it also does not work

    ------------------------------after i am test using ---------------------------------------------
    networkDignostic link:- http://supportforums.blackberry.com/t5/Java-Development/What-Is-Network-API-alternative-for-legacy-O...

    use networkDignostic to test the available transport connection

    Here is the result

    The Radio Signal level:-81 dBm
    WIFI Signal level: No coverage
    Network name: Vodafone in
    Network type: GPRS
    Network services: data + EDGE + voice
    PIN: 27F03947
    Battery: 81%
    = End of network Info =.
    Transport: by default (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /
    Journal:

    Login to http://www.google.ca:80 /
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: by default (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80
    Journal:

    Connecting to a socket: / /www.google.ca:80
    Opening connection...
    Error: java.io.IOException: invalid url parameter.
    = END OF LOG =.

    Transport: by default (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /
    Journal:

    Login to http://www.google.ca:80 /
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: By default (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80
    Journal:

    Connecting to a socket: / /www.google.ca:80
    Opening connection...
    Error: java.io.IOException: invalid url parameter.
    = END OF LOG =.

    Transport: TCP cellular (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true
    Journal:

    Login to http://www.google.ca:80 /; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: TCP cell (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: TCP cellular (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true
    Journal:

    Login to http://www.google.ca:80 /; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: TCP cell (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: MDS (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: MDS (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: MDS (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: MDS (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no MDS do not service records found.
    Ignored test: coverage of SDM is not available

    Transport: BIS - B (HTTP GET)
    Result: pass
    Answer: 200
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = false; ConnectionType = m * s - pub *
    Journal:

    Login to http://www.google.ca:80 /; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Definition of the properties of application...
    Host: www.google.ca
    User-Agent: Mozilla/4.0
    Connection: close
    Get the response code...
    Response code: 200
    Got the content length:-1 bytes
    Downloading content...
    Download time: 3,034 seconds
    Downloaded: 37943 bytes
    Closes the connection...
    Connection closed
    = END OF LOG =.

    Transport: BIS - B (Socket GET)
    Result: pass
    Answer: 200
    Length: 38696
    URL: socket: / /www.google.ca:80; deviceside = false; ConnectionType = m * s - could * c
    Journal:

    Connecting to a socket: / /www.google.ca:80; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Send GET request:
    "GET / HTTP/1.1".
    Host: www.google.ca
    User-Agent: Mozilla/4.0
    Connection: close

    "
    Downloading content...
    Download time: 2,397 seconds
    Downloaded: 38696 bytes
    Closing connection
    Connection closed
    = END OF LOG =.

    Transport: BIS - B (HTTP POST)
    Result: failure
    Answer: 405
    Length: 959
    URL: http://www.google.ca:80 /; deviceside = false; ConnectionType = m * s - p * ic
    Journal:

    Login to http://www.google.ca:80 /; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Request method POST value
    Definition of the properties of application...
    Host: www.google.ca
    Content-Length: 1500
    Content-Type: application/octet-stream
    User-Agent: Mozilla/4.0
    Connection: close
    Display of 1 500 bytes...
    Posted 1 500 bytes
    Get the response code...
    Response code: 405
    Got the content length: 959 bytes
    Downloading content...
    Download time: 1,044 seconds
    Downloaded: 959 bytes
    Closing connection
    Connection closed
    = END OF LOG =.

    Transport: BIS - B (POST plug)
    Result: failure
    Answer: 405
    Length: 1204
    URL: socket: / /www.google.ca:80; deviceside = false; ConnectionType = m * Pei * li *
    Journal:

    Connecting to a socket: / /www.google.ca:80; * only given to the RIM ISV partners.
    Opening connection...
    Open connection
    Definition of the properties of application...
    Envoy POST request:
    "POST / HTTP/1.1".
    Host: www.google.ca
    Content-Length: 1500
    Content-Type: application/octet-stream
    User-Agent: Mozilla/4.0
    Connection: close

    "
    Display of 1 500 bytes...
    Posted 1 500 bytes
    Downloading content...
    Download time: 2,041 seconds
    Downloaded: 1204 bytes
    Closing connection
    Connection closed
    = END OF LOG =.

    Transport: WAP (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: no WAP do not service records found.
    Ignored test: coverage WAP is not available
    Ignored test: Please provide IP and APN WAP

    Transport: WAP2 (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connection http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WAP2 (socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WAP2 (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connection http://www.google.ca:80 /; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WAP2 (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Journal:

    Connecting to a socket: / /www.google.ca:80; deviceside = true; ConnectionUID = WAP2 trans
    Opening connection...
    Error: net.rim.device.internal.io.CriticalIOException: failed criticism tunnel
    = END OF LOG =.

    Transport: WiFi (HTTP GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Transport: WiFi (Socket GET)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Transport: WiFi (HTTP POST)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Transport: WiFi (POST plug)
    Result: failure
    Answer:-1
    Length:-1
    URL: Not available url
    Journal:

    Ignored test: WiFi coverage is not available

    Thank you peter and jovinz

    I think I have problem in httpconnectionfactory with several url parameter, as peter says

    so now I have usr post url as the code below

       public static void CheckConnection()
        {
            HttpConnection hc=null;
            try
            {
                //Wifi Connection
                if ( (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) && RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN))
                {
                    ConstantData.postURL=";interface=wifi";
                    return;
                }
                //for BES or MDS Connection
                if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS))
                {
                    boolean connectionFlag=false;
                    String post_url;
    
                    //for BES Connections
                    post_url="";
                    try
                    {
                        hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url,Connector.READ_WRITE);
                        if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                        {
                            connectionFlag=true;
                            ConstantData.postURL=post_url;
                            return;
                        }
                        if(hc!=null)
                            hc.close();
                    }
                    catch (Exception e)
                    {
                        System.out.println(e.toString());
                        connectionFlag=false;
                    }
                    //for MDS Connection
                    if(!connectionFlag)
                    {
                        try
                        {
                            post_url = ";deviceside=false";
                            hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);
                            if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                            {
                                ConstantData.postURL=post_url;
                                return;
                            }
                            if(hc!=null)
                                hc.close();
                        }
                        catch (Exception e)
                        {
                            System.out.println(e.toString());
                        }
                    }
                }
                //for BIS Connection
                if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_BIS_B))
                {
                    //BIS Connection
                    String post_url = ";deviceside=false;ConnectionType=m**-pu***c";
                    try
                    {
                        hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);//Connector.READ_WRITE
                        if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                        {
                            ConstantData.postURL=post_url;
                            return;
                        }
                        if(hc!=null)
                            hc.close();
                    }
                    catch (Exception e)
                    {
                        System.out.println(e.toString());
                    }
                }
                //for WAP Connection
                if(CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT))
                {               //for WAP Connection
                    String post_url = null;
                    ServiceBook sb = ServiceBook.getSB();
                    ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
                    String uid = null;
                    boolean connectionFlag=false;
                    for(int i=0; i < records.length; i++)
                    {
                        if (records[i].isValid() && !records[i].isDisabled())
                        {
                            if (records[i].getUid() != null && records[i].getUid().length() != 0)
                            {
                                if ((records[i].getUid().toLowerCase().indexOf("wifi") == -1) &&
                                        (records[i].getUid().toLowerCase().indexOf("mms") == -1))
                                {
                                    uid = records[i].getUid();
                                    break;
                                }
                            }
                        }
                    }
                    if (uid != null)
                    {
                        post_url= ";deviceside=true;ConnectionUID=" + uid;
                    }
                    try
                    {
                        hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);
                        if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                        {
                            connectionFlag=true;
                            ConstantData.postURL=post_url;
                            return;
                        }
                        if(hc!=null)
                            hc.close();
                    }
                    catch (Exception e)
                    {               System.out.println(e.toString());
                    connectionFlag=false;
                    }
                    if(!connectionFlag)
                    {
                        post_url=";deviceside=true;apn=blackberry.net";
                        try
                        {
                            hc = (HttpConnection) Connector.open("http://www.rim.com"+post_url);
                            if(hc.getResponseCode()==HttpConnection.HTTP_OK)
                            {
                                ConstantData.postURL=post_url;
                                return;
                            }
                            if(hc!=null)
                                hc.close();
                        }
                        catch (Exception e)
                        {
                            System.out.println(e.toString());
                        }
                    }}
            }
            catch (Exception e)
            {
    
                e.printStackTrace();
            }
            finally
            {
                try
                {
                    if(hc!=null)
                        hc.close();
                } catch (IOException e) {
                    System.out.println(e.toString());
                    e.printStackTrace();
                }
            }
    
        }
    

    so now its works on WAP2, BIS and the WIFi works fine

    the first issue of priority celluler TCP post code is also more WAP2 then

    Thus, each transport time select TCP when BIS, WIFI not presend and need for apn

    in any case, once again, thank you Peter and demo tools network dignostic is awasome...

  • Error! : duplicate definition for 'org.kxml2.io.KXmlParser '.

    Hi all

    Below I have attached my code using KSoap2.

    The following error message get up when I run the project.

    ".. \lib\kxml2-min-2.3.0.jar(org/kxml2/IO/KXmlParser.class): error! ': duplicate definition for 'org.kxml2.io.KXmlParser', in: org.kxml2.io.KXmlParser.

    I looked in the forums of BB, but I can't solve this problem...

    Please tell me hoe to solve this problem

    package mypackage;
    
    import java.io.InputStream;
    import java.io.OutputStream;
    
    import javax.microedition.io.Connector;
    import javax.microedition.io.HttpConnection;
    
    import org.ksoap2.SoapEnvelope;
    import org.ksoap2.serialization.SoapObject;
    import org.ksoap2.serialization.SoapSerializationEnvelope;
    import org.kxml2.io.KXmlParser;
    import org.xmlpull.v1.XmlPullParser;
    
    import net.rim.device.api.compress.GZIPOutputStream;
    import net.rim.device.api.system.CoverageInfo;
    import net.rim.device.api.system.WLANInfo;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.container.MainScreen;
    
    /**
     * A class extending the MainScreen class, which provides default standard
     * behavior for BlackBerry GUI applications.
     */
    public final class MyScreen extends MainScreen
    {
        /**
         * Creates a new MyScreen object
         */
        public MyScreen()
        {
            // Set the displayed title of the screen
            setTitle("MyTitle");
            ButtonField bf = new ButtonField();
            add(bf);
            BenoListener benoListener = new BenoListener();
            bf.setChangeListener(benoListener);
        }
    
        public class BenoListener implements FieldChangeListener {
            public void fieldChanged(Field field, int context) {
                try {
                    String serviceNamespace = "http://www.google.com/Services/google/";
                    String soapAction = "http://www.google.com/Services/google/Login";
                    String methodName= "Login";
                    String result = "";
                    String begin = ""
                            + "http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                            + "";
                    String end = "" + "";
                    String soapBody =begin;
                    soapBody += "http://www.google.com/Services/google\">";
                    soapBody += "";
                    soapBody += "[email protected]";
                    soapBody += "";
                    soapBody += "";
                    soapBody += "12345678";
                    soapBody += "";
                    soapBody += "";
                    soapBody += end;
                    SoapObject rpc = new SoapObject(serviceNamespace, methodName);
                    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                    envelope.encodingStyle = SoapSerializationEnvelope.ENC;
                    HttpConnection connection = (HttpConnection) Connector.open("https://services.google.com:8443/axis2/services/api/V1.0/GoogleServices"+ getConnectionParameter(),Connector.READ_WRITE);
                    connection.setRequestProperty("SOAPAction", soapAction);
                    connection.setRequestProperty("Content-Type", "application/x-gzip");
                    connection.setRequestProperty("Content-Encoding", "gzip");
                    connection.setRequestProperty("Accept-Encoding", "gzip");
                    connection.setRequestProperty("Content-Length","" + soapBody.getBytes().length);
                    connection.setRequestProperty("User-Agent", "kSOAP/2.0");
                    connection.setRequestMethod(HttpConnection.POST);
                    OutputStream os = connection.openOutputStream();
    
                    zipRequest(os, soapBody);
    //              os.write(soapBody.getBytes(), 0, soapBody.getBytes().length);
    //              os.close();
                    soapBody = null;
                    InputStream is = connection.openInputStream();
                    XmlPullParser xp = new KXmlParser();
                    xp.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
                    xp.setInput (is, null);
                    envelope.parse(xp);
                    result = (envelope.getResponse()).toString();
                    Dialog.alert("Result---"+result);
                } catch (Exception ex) {
                }
    
            }
    
            private String getConnectionParameter() {
                String connectionParameter = "";
                if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
                    connectionParameter = ";interface=wifi";
                } else {
                    int coverageStatus = CoverageInfo.getCoverageStatus();
                    if ((coverageStatus & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS) {
                        connectionParameter = ";deviceside=false";
                    } else if ((coverageStatus & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT) {
                        connectionParameter = ";deviceside=true";
                    }
                }
                return connectionParameter;
            }
    
                public void zipRequest(OutputStream io, String data) throws Exception{
                    try{
                        GZIPOutputStream gz = new GZIPOutputStream(io);
                        byte[] bytes = data.getBytes("UTF-8");
                        gz.write(bytes, 0, bytes.length);
                        gz.close();
                    }
                    catch(Exception ex){
                    }
            }
    
    }
    }
    

    I solved this problem of "Preverify" jar

  • Sending data to the web and try again

    I have a web application running on Tomcat configured to accept data that I send from my 9000 "BOLD".  I have a test application now running on my BB.  I see examples for sending data, but I can't seem to find a way to roll everything into one. I was hoping someone can direct me to a post/example/etc that would meet my needs.

    I want to send my bb to my web application data, sometimes the text, sometimes media / other.  I want it will retry connections if it is not complete fully and hold until it does (or timeout after that # attempts then abandon).  If the sending of a photo on the EDGE and connection falls Mid-upload, I want he's trying to take over.  If theres no data connection, save and try again later.  I'm sure that it's simple, but I couldn't find anything in my research.

    Thanks for any help,

    Song

    Browse documents of the API, including at the level of the connector, class HttpConnection, CoverageInfo and coverage. Once you are familiar with those, you can get what you want easily.

  • GetResponseCode of the HTTP connection failed? :(

    Hey all,.

    I am fairly new to the development of BB.  I'm trying to get my application to connect to the web and pull down some data.  I think I'm close, but after using the debugger and stepping through my code, I noticed it stops at the ' rc = c.getResponseCode (); "subscribed line.  (Stops, I mean it running... it doesn't give any errors, but he never stepped on the next line... everythign is right there...)

    What Miss me?

    System.out.println(">>> in new threads run");
                    try {
                        HttpConnection c = null;
                        InputStream is = null;
                        int rc;
    
                        try {
                            System.out.println(">>> in new threads try");
                            c = (HttpConnection)Connector.open("http://www.google.ca");
                            System.out.println(">>> c : "+c);
                            // Getting the response code will open the connection,
                            // send the request, and read the HTTP response headers.
                            // The headers are stored until requested.
                            rc = c.getResponseCode();
                            System.out.println(">>> rc : "+rc);
                            //testing(rc);
                            //String ryan = Integer.toString(rc);
                            //Bitmap icon = Bitmap.getBitmapResource("img/download.png");
                            //statusDlg = new Dialog(ryan,null,null,0,icon);
                            //statusDlg.show();
                            if (rc != HttpConnection.HTTP_OK) {
                                throw new IOException("HTTP response code: " + rc);
                            }
    
                            is = c.openInputStream();
                            System.out.println(">>> is : "+is);
    
                            // Get the ContentType
                            String type = c.getType();
                            System.out.println(">>> type : "+type);
    
                            // Get the length and process the data
                            int len = (int)c.getLength();
                            System.out.println(">>> len : "+len);
                            if (len > 0) {
                                int actual = 0;
                                int bytesread = 0 ;
                                byte[] data = new byte[len];
                                while ((bytesread != len) && (actual != -1)) {
                                    actual = is.read(data, bytesread, len - bytesread);
                                    bytesread += actual;
                                }
                            } else {
                                int ch;
                                while ((ch = is.read()) != -1) {
    
                                }
                            }
                        } catch (ClassCastException e) {
                            System.out.println(">>> WTF : "+e);
                            throw new IllegalArgumentException("Not an HTTP URL");
                        } finally {
                            System.out.println(">>> WTF2");
                            if (is != null)
                                is.close();
                            if (c != null)
                                c.close();
                        }
                    } catch (IOException e) {
                    } catch (Exception e)
                    {
                        e.printStackTrace();
                    }
    

    He may be waiting the connection end. Network connection attempts take awhile to timeout - the order of minutes. If you are debugging in the Simulator, you shot above the MDS Simulator? If a device is connected?

    You can also take a look at the CoverageInfo class as a way to check the availability of connection before you actually start a connection.

  • BIS push registration for lack of client app

    Hi all

    I'm trying to implement the push BIS service in the client application.

    I got the Port number, appId, BPA URL & using that i'm trying to register using the code below

    public boolean registerBpas() {}

    Logger.info ("MyScreen.registerBpas ()");
    /**
    As the suffix of the connection is fixed I just use a Thread to call the code of connection
    *
    **/

    isValue Boolean = false;
           
    try {}
    Logger.info ("-step 1");
    String conparam = getConnParam();
    Logger.info ("---> conparam:" + conparam);
    final String registerUrl = formRegisterRequest (null, BPAS_URL, APP_ID), + conparam / * Conn.getConnectionParameters () * /;
    Logger.info ("\n\n\n msg registerBPAS URL is:" + registerUrl);
    HttpConnection httpConnection = (HttpConnection), Connector.open (registerUrl);
    InputStream is = httpConnection.openInputStream ();
    Response string = new String (IOUtilities.streamToBytes (is));
    Logger.info ("\n\n\n\n\n\n msg RESPOSE CODE:" + response);
    Close (httpConnection, is, null);
    String nextUrl = formRegisterRequest (BPAS_URL, APP_ID response) + conparam / * Conn.getConnectionParameters () * /;
    Logger.info ("\n\n\n\n\n\n msg nextUrl:" + nextUrl);
    HttpConnection nextHttpConnection = (HttpConnection), Connector.open (nextUrl);
    InputStream nextInputStream = nextHttpConnection.openInputStream ();
    response = new String (IOUtilities.streamToBytes (nextInputStream));
    Logger.info ("\n\n\n\n\n\n msg RESPOSE CODE 1:" + response);
    Close (nextHttpConnection, is, null);
    If (REGISTER_SUCCESSFUL.equals (response) |) {USER_ALREADY_SUBSCRIBED. Equals (Response))}
    Logger.info ("saved successfully to push BIS msg");
                            
    Returns true;
    } else {}
    Logger.info ("msg record BPA rejected");
    isValue = false;
    Returns false;
    }
    } catch (final IOException e) {}

    Logger.info ("IOException msg on register()" + e + "" + e.getMessage ());
    isValue = false;
    Returns false;
    }
                    
    Return isValue;
    }

    public static close Sub (conn connection, InputStream is, OutputStream os) {}
    If (OS! = null) {}
    try {}
    OS. Close();
    } catch (IOException e) {}
    }
    }
    If (is! = null) {}
    try {}
    is. Close();
    } catch (IOException e) {}
    }
    }
    If (conn! = null) {}
    try {}
    Conn.Close ();
    } catch (IOException e) {}
    }
    }
    }

    Public Shared Sub errorDialog (final String message)
    {
    UiApplication.getUiApplication () .invokeLater (new Runnable()
    {
    public void run()
    {
    Dialog.Alert (message);
    }
    });
    }

    private static String formRegisterRequest (String bpasUrl, String appId, string token) {}
    StringBuffer sb = new StringBuffer (bpasUrl);
    SB. Append("/MSS/PD_subReg?");
    SB. Append ("ServiceId ="). Append (appid);
    SB. Append("&OSVersion="). Append (DeviceInfo.getSoftwareVersion ());
    SB. Append("&Model="). Append (DeviceInfo.getDeviceName ());
    If (token! = null & token.length () > 0) {}
    SB. Append("&"). Append (Token);
    }
    Return sb.toString ();
    }
        
        
        
    public static String getConnParam() {}
    String connectionParameters = "";
    If (WLANInfo.getWLANState () == WLANInfo.WLAN_STATE_CONNECTED) {}
    Connected to a WiFi access point
    connectionParameters = «;» deviceside = true; interface = wifi. "
    } else {}
    int coverageStatus = CoverageInfo.getCoverageStatus ();
    ServiceRecord record = getWAP2ServiceRecord();
    If (record! = null)
    & (coverageStatus & CoverageInfo.COVERAGE_DIRECT) ==
    CoverageInfo.COVERAGE_DIRECT) {}
    Having network coverage and a book of WAP 2.0 service record
    connectionParameters = «;» deviceside = true; ConnectionUID ="
    + record.getUid ();
    } else if ((coverageStatus & CoverageInfo.COVERAGE_MDS) ==)
    CoverageInfo.COVERAGE_MDS) {}
    Have a book cover and SDM service network
    connectionParameters = «;» deviceside = false;
    } else if ((coverageStatus & CoverageInfo.COVERAGE_DIRECT) ==)
    CoverageInfo.COVERAGE_DIRECT) {}
    Have the network coverage, but no trace of service WAP 2.0 book
    connectionParameters = «;» deviceside = true;
    }

    }
    Return connectionParameters;
    }
    private static {ServiceRecord getWAP2ServiceRecord()
    Full book sb = ServiceBook.getSB ();
    Reviews [] ServiceRecord = sb.getRecords ();
    for (int i = 0; i)< records.length;="" i++)="">
    String cid = records [i] .getCid () .toLowerCase ();
    String uid = records [i] .getUid () .toLowerCase ();

    If (cid.indexOf ("wptcp")! = - 1 &)
    uid.indexOf ("wifi") ==-1 &.
    uid.indexOf ("mms") ==-1) {}
    Returns records [i];
    }
    }
    Returns a null value.
    }

    But I m getting the error below

    Timeout occurred while processing the operation.

    Check the log of the unit below

    INFO: File created successfully
    INFO: MyScreen.registerBpas)
    INFO:-step 1
    NEWS :---> conparam:; deviceside = true; ConnectionUID = WAP2 trans
    INFO:

    registerBPAS MSG URL is: http://pushapi.eval.blackberry.com/mss/PD_subReg?serviceid=2350-7la145e5r36mi1n42M6037M9600e95a1155&... trans
    INFO:

    MSG RESPOSE CODE:

    Timeout occurred while processing the operation.

    INFO:

    MSG nextUrl: http://pushapi.eval.blackberry.com/mss/PD_subReg?serviceid=2350-7la145e5r36mi1n42M6037M9600e95a1155&...

    Timeout occurred while processing the operation.

    ; deviceside = true; ConnectionUID = WAP2 trans
    INFO:

    MSG RESPOSE CODE 1:

    Has received a bad request formed.

    INFO: msg BPA rejected registration
    INFO:-isSub: false

    Hi Simon

    His work... Register register & to work...

    Thank you very much for your answer...

    In fact, in connection suffix, I used [deleted inappropriate content]

    There must be a hyphen (-) between mds & public, its not allow me to type this text because it's in this forum.

    And tested device in...

    This connection suffix is transposition BIS & now I am able to register and de-register my app to push.

    But still, I need to test the receiver push message part, once my server implementation is made.

    Once again thanks a lot...

    Thank you

    Lauriane


  • To check network coverage and queues requests

    Hello

    We develop a simple application with webservices.

    I need check the coverage of the network before requesting Web services...

    If the mobile is on the cover, I have to send the request.

    If the mobile is not in the blanket, I at the request of the queue and I send the application when I had the network...

    According to the documents, I have to use "class ofCoverageInfo and CoverageStatusListener '. '"

    are there examples...?

    Please let me know how to use these classes...

    import net.rim.device.api.system.CoverageInfo;
    import net.rim.device.api.system.CoverageStatusListener;
    
    public class MyClass implements CoverageStatusListener {
    
        public MyClass() {
            CoverageInfo.addListener(this);
        }
    
        public void coverageStatusChanged(int arg0) {
            switch(arg0) {
                case(CoverageInfo.COVERAGE_DIRECT):
                    //do something
                case(CoverageInfo.COVERAGE_MDS):
                    //do something
                case(CoverageInfo.COVERAGE_NONE):
                    //do something
            }
        }
    }
    
  • Uncaught exception on HttpConnection when the URL is blocked

    I access my request, a service URL web restful. Whenever the device is connected, but the URL is not accessible or non-responsive for some reason, I get an untrapped exception. All I want is to catch the exception and displays an appropriate message.

    Ideally, I'd like

    1. check whether the URL is accessible

    2. wait a little longer if the URL is accessible but slow

    Please suggest. Thank you.

    Code: (relevant articles)

        public void fieldChanged(Field field, int context) {
    
            if (field == btnOK) {
                UiApplication.getUiApplication().invokeLater(new Runnable() {
    
                    public void run() {
                                    String value=VerifyPinCode(rdPinCode.getText(),rd.getText());
    
                                    if (value.substring(0,4).equals("true")) {
                                                                            // do stuff
                                    } else {
                                        count = count++;
                                    }
                                  }
                });
    
            } else if (field == btnCancel) {
                close();
            }
    
        }
    
        public String VerifyPinCode(String PinCode, String VRN) {
            try {
    
                if (WebService.CheckConn())
                        {
                            try{
                        WebService wb = new WebService(
                                "http://webservice.somewhere.com:8088/mywebservice.svc/WebTestMethod/"
                                            + VRN
                                        + "/" + PinCode);
                               wb.start();
                        wb.join();
                        Responce = wb.Call();
                        }
                        catch(InterruptedException  ex)
                        {
                            Dialog.alert("No Internet Connection");
                        }
                    }
    
    public class WebService extends Thread {
        static HttpConnection con = null;
        static InputStream is = null;
        static StringBuffer rawResponse;
        String URL;
        public String resultant;
    
        WebService(String url) {
            URL = url + getConnectionString() + ";ConnectionTimeout=20000";
    
        }
    
        public void run() {
    
            try {
                con = (HttpConnection) Connector.open(URL, Connector.READ_WRITE,
                        true);
                int rcc = con.getResponseCode();
    
            } catch (IOException e) {
                // TODO Auto-generated catch block
                con = null;
                // Status.show(e.getMessage());
            }
    
            //catch (Exception ex) {
            // TODO Auto-generated catch block
            //con = null;
            // Status.show(e.getMessage());
            //}
    
        }
    
        public String Call() {
            try {
    
                // ConnectionTimeout=9000;";
                if (CheckConn()) {
    
                    if (con == null) {
                        rawResponse = new StringBuffer();
                        rawResponse.append("Timed out");
    
                    } else {
                        is = con.openInputStream();
                        // // Status.show("3");
    
                        byte[] responseData = new byte[10000];
                        int length = 0;
                        rawResponse = new StringBuffer();
                        while (-1 != (length = is.read(responseData))) {
                            rawResponse.append(new String(responseData, 0, length));
                            // Status.show("4");
    
                        }
                    }
                } else {
                    Status.show("Internet service is not avaiable.");
                }
                // Status.show(result);
    
            } catch (Exception ex) {
                Status.show("Internet is not responding");
            } finally {
                try {
                    if (is != null) {
                        is.close();
                    }
                    if (con != null) {
                        con.close();
                    }
                } catch (Exception e) {
                    // Status.show(e.getMessage());
                }
            }
            return rawResponse.toString();
    
        }
    
        public String getConnectionString() {
    
            String connectionString = "";
            if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
                connectionString = ";interface=wifi";
            }
    
            else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS) {
                connectionString = ";deviceside=false";
            } else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT) {
                String carrierUid = getCarrierBIBSUid();
                if (carrierUid == null) {
                    connectionString = ";deviceside=true";
                } else {
                    connectionString = ";deviceside=false;connectionUID="
                            + carrierUid + ";ConnectionType=amdeeas-public";
                }
            } else if (CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE) {
                connectionString = ";None";
    
            }
    
            return connectionString;
        }
    
        public String getCarrierBIBSUid() {
    
            net.rim.device.api.servicebook.ServiceRecord[] records = ServiceBook
                    .getSB().getRecords();
            int currentRecord;
    
            for (currentRecord = 0; currentRecord < records.length; currentRecord++) {
                if (records[currentRecord].getCid().toLowerCase().equals("ippp")) {
                    if (records[currentRecord].getName().toLowerCase()
                            .indexOf("bibs") >= 0) {
                        return records[currentRecord].getUid();
                    }
                }
            }
    
            return null;
        }
    
        public static boolean CheckConn() {
            try {
                if (WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) {
                    return true;
                } else if (CoverageInfo.getCoverageStatus() >= 2) {
                    return true;
                } else if (CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_DIRECT) {
                    return false; //false for device, true for simulator
                } else {
                    return false;
                }
            } catch (Exception ex) {
                Dialog.alert("No Internet Connection");
                return false;
            }
        }
    
    }
    

    remove the thread.join and the call to Call(), you block the user interface and the device to start a thread at all.
    To get a response from the thread, you can use the callback model, for example.

  • Check if the internet access available

    Hi, I use this rotuine to check if my application has access to internet Conect to certain web services.

    public static boolean isInternetAvailable() {
            boolean result = false;
    
            // Toma transportes disponibles
            int[] transportArray = TransportInfo.getAvailableTransportTypes();
            for (int i = transportArray.length - 1; i > - 1; i--) {
                if (TransportInfo.hasSufficientCoverage(i)) {
                    result = true;
                    break;
                }
            }
    
            return result;
        }
    

    But this code works sometimes. I am running in the Simulator (and phones, especially with OS 7) and I'm positive that I have network access, but the method return false sometimes...

    Is there an another safer way to check this?

    Simon, so just

    public static boolean isInternetAvailable() {
        return CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT);
    }
    

    It works perfectly...

    Thank you very much Simon...!

Maybe you are looking for

  • Apple on ATV3 music? When

    I agree with Apple music and can play the content on my iPhone and Mac, however when it comes to listening to music in my Apple TV 3 rd Gen, no. I just can't get the same content to display. Of course, it shows the music I downloaded on my account or

  • How do I configure my iPhone 6 s more so I can dictate a text?

    How do I voice text?

  • Question about WiFi MiniPCI Satellite 1410

    My Satellite 1410 802 is ready to install the Mini-PCI Wireless card.1. what it means that I can install the map made by any seller (Gigabyte?) or only Toshiba?2. what antenna? This model equipted with antenna internal or should I buy it with the min

  • Games freezing, I need to do a hard reboot.

    I am running windows 7 64-bit, and I have various games just gel with a constant buzz audio.  This produced so far in Bad Company 2, COD4, CODMW2.  It will happen random; sometimes 2 minutes in the game, sometimes 2 hours.  I tried to roll back my dr

  • CHKDSK, delete the Index files and recover... Is this possible?

    Well, today I decided I wanted to store a few photos from my camera to my external hard drive and so I plugged into my laptop which was my SD card ready to export/import. Right, so all the files are saved on the external hard drive when I safely ejec