Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 4
Registered: ‎03-17-2012
My Device: blackberry curve 8520
My Carrier: NA

How to detect the network connection url suffix with no BIBS service enabled.

I am using the following code to connect to a secured url but getting IOException as it says "Could not find a service book entry for IPPP". This service is not available in service book. This exception is occuring in case of BB9810 which is of BB OS 7.0 .Is there any alternative to connect to a secured link with a carrier.

 


HttpConnection httpConn = (HttpConnection) Connector.open(url);

where,

url=url+getConnectionString();

private static String getConnectionString()
{


        String connectionString = null;
        try {
                             
            
            if(DeviceInfo.isSimulator())
            {
                if(Constants.USE_MDS_IN_SIMULATOR)
                {
                    connectionString = ";deviceside=false";

                }
                else
                {
                    connectionString = ";deviceside=true";

                }
                    
            }                                        
                    
            // Wifi is the preferred transmission method
            else if(WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
            {
                
                connectionString = ";interface=wifi";
            }
                            
            // Is the carrier network the only way to connect?
            else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_DIRECT) == CoverageInfo.COVERAGE_DIRECT)
            {
                        
                String carrierUid = getCarrierBIBSUid();
              
                if(carrierUid == null)
                {
                    // Has carrier coverage, but not BIBS.  So use the carrier's TCP network
                    carrierUid = getWAP2ServiceRecord();
                    if (carrierUid != null)
                    {
                        // Try using WAP2
                        connectionString = ";deviceside=false;connectionUID="+carrierUid;  
                    }
                    else
                    {
                        // Has carrier coverage, but not BIBS or WAP2.  So use the carrier's TCP network
                        connectionString = ";deviceside=true";
                    }

                }
                else
                {
                    // otherwise, use the Uid to construct a valid carrier BIBS request
                    connectionString = ";deviceside=false;connectionUID="+carrierUid + ";ConnectionType=mdsss-public";

                }
            }                
            
            // Check for an MDS connection instead (BlackBerry Enterprise Server)
            else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
            {
                connectionString = ";deviceside=false";
            }
            
            // If there is no connection available abort to avoid bugging the user unnecssarily.
            else if(CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE)
            {
                logMessage("There is no available connection.");
            }
            
            // In theory, all bases are covered so this shouldn't be reachable.
            else
            {
                connectionString = ";deviceside=true";
            }        
            
            return connectionString;
        } catch (Exception e) {
            // TODO Auto-generated catch block
            return connectionString;
        }
    


    }
    
    
    
    private static String getCarrierBIBSUid()
    {
        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;
    }


    private static String getWAP2ServiceRecord()
    {
      ServiceBook sb = ServiceBook.getSB();
      ServiceRecord[] records = sb.getRecords();
      Constants.rmsUtility.writeData("getWAP2ServiceRecord::records.length::"+records.length);
      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))
        {
            return records[i].getUid();
        }
      }
      return null;
    }    

 

I am looking forward a solution to this and thanks a lot in advance for paying attention to my query.

 

Chinmay Kumar.

 



   

 

 

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to detect the network connection url suffix with no BIBS service enabled.

i suggest to use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/io/transport/ConnectionFactory...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to detect the network connection url suffix with no BIBS service enabled.

I agreem with simon.  Also I keep seeing this:

 

// Try using WAP2
                        connectionString = ";deviceside=false;connectionUID="+carrierUid;  

 

This code is not correct, it is deviceside=true