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
Developer
Posts: 52
Registered: ‎11-21-2009
My Device: Not Specified

Indonesia HTTP connection ?

Hi. What is the HTTP connection string for Indonesia (for example Telkomsel carrier) ?  Is there any difference in connection string ?

Developer
Posts: 52
Registered: ‎11-21-2009
My Device: Not Specified

Re: Indonesia HTTP connection ?

It's possible to download the thir party app, but no way to activate the app trough HTTP connection. The connection string was built accordind following logic:

 

 if(DeviceInfo.isSimulator())
 {

}

 

 

else if((WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED) )
        {
            
            logMsg("Device is connected via Wifi.");
            connString = ";interface=wifi";
            connMethod = "wifi";
        }   
                
        // Check is the carrier network the only way to connect?
        else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_CARRIER) == CoverageInfo.COVERAGE_CARRIER)
        {
           
            logMsg("Carrier coverage.");            
            String carrierUid = getCarrierBIBSUid();
            String carrierWPTCPUid = getCarrierWapTransport();
            if(carrierUid == null)
            {
                if (carrierWPTCPUid == null)
                {                
                // has carrier coverage, but not BIBS.  So use the carrier's TCP network
                logMessage("No Uid");
                connString = ";deviceside=true";
                connMethod = "tcp";
            }
            else
            {
                    connString = ";ConnectionUID=" + carrierWPTCPUid;
                    connMethod = "wptcp";
                }
            }
            else
            {
                // otherwise, use the Uid to construct a valid carrier BIBS request
               logMsg("uid is: " + carrierUid);
                connString = ";deviceside=false;connectionUID="+carrierUid + ";ConnectionType=mds-pub";
                connMethod = "bibs";
            }
        }                
        
        // Check for an MDS connection instead (BlackBerry Enterprise Server)
        else if((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
        {
           logMsg("MDS coverage found");
            connString = ";deviceside=false";
            connMethod = "bes";
        }
        
        // If there is no connection available abort to avoid bugging the user unnecssarily.
        else if(CoverageInfo.getCoverageStatus() == CoverageInfo.COVERAGE_NONE)
        {
           logMsg("There is no available connection.");
        }
        
        // In theory, all bases are covered so this shouldn't be called.
        else
        {
          logMessage("no other options found, assuming device.");
            connString = ";deviceside=true";
            connMethod = "other";
        }        
        
        return connString+"%"+connMethod;
    }
    
    /**
     * Looks through the phone's service book for a carrier provided BIBS network
     * @return The uid used to connect to that network.
     */
    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 getCarrierWapTransport()
    {
        ServiceBook sb = ServiceBook.getSB();
        ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
        String uid = null;
        
        for(int i=0; i < records.length; i++)
        {
            //Search through all service records to find the
            //valid non-Wi-Fi and non-MMS
            //WAP 2.0 Gateway Service Record.
            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;
                    }
                }
            }
        }
        return uid;
    }

 

If somebody else have experienced issues with Indonesia carriers then will helpfull to know why and if there was found a solution ... ?

Developer
Posts: 112
Registered: ‎09-23-2009
My Device: Not Specified

Re: Indonesia HTTP connection ?

I use this class to get APN and password for networks in Indonesia. Hope this help you.

 

 

public class NetworkOperator {
    public static final String APN_MATRIX = "satelindogprs.com";
    public static final String APN_USER_MATRIX = "";
    public static final String APN_PASSWORD_MATRIX = "";

    public static final String APN_IM3 = "www.indosat-m3.net";
    public static final String APN_USER_IM3 = "gprs";
    public static final String APN_PASSWORD_IM3 = "im3";

    public static final String APN_XL = "www.xlgprs.net";
    public static final String APN_USER_XL = "www.xlgprs.net";
    public static final String APN_PASSWORD_XL = "wap123";

    public static final String APN_HALO = "telkomsel";
    public static final String APN_USER_HALO = "wap";
    public static final String APN_PASSWORD_HALO = "wap123";

    public static final String APN_SIMPATI = "telkomsel";
    public static final String APN_USER_SIMPATI = "wap";
    public static final String APN_PASSWORD_SIMPATI = "wap123";

    public static String getAPNFromDetectedCarrier() {
        String result = "";
        String networkName = RadioInfo.getCurrentNetworkName();

        if (networkName.toLowerCase().indexOf("indosat")!=-1) {
            result = NetworkOperator.APN_IM3;
        } else if (networkName.toLowerCase().indexOf("satelindo")!=-1) {
            result = NetworkOperator.APN_MATRIX;
        } else if (networkName.toLowerCase().indexOf("xl")!=-1) {
            result = NetworkOperator.APN_XL;
        } else if (networkName.toLowerCase().indexOf("telkomsel")!=-1) {
            result = NetworkOperator.APN_SIMPATI;
        }
        return result;
    }

    public static String getAPNUserFromDetectedCarrier() {
        String result = "";
        String networkName = RadioInfo.getCurrentNetworkName();

        if (networkName.toLowerCase().indexOf("indosat")!=-1) {
            result = NetworkOperator.APN_USER_IM3;
        } else if (networkName.toLowerCase().indexOf("satelindo")!=-1) {
            result = NetworkOperator.APN_USER_MATRIX;
        } else if (networkName.toLowerCase().indexOf("xl")!=-1) {
            result = NetworkOperator.APN_USER_XL;
        } else if (networkName.toLowerCase().indexOf("telkomsel")!=-1) {
            result = NetworkOperator.APN_USER_SIMPATI;
        }
        return result;
    }

    public static String getAPNPasswordFromDetectedCarrier() {
        String result = "";
        String networkName = RadioInfo.getCurrentNetworkName();

        if (networkName.toLowerCase().indexOf("indosat")!=-1) {
            result = NetworkOperator.APN_PASSWORD_IM3;
        } else if (networkName.toLowerCase().indexOf("satelindo")!=-1) {
            result = NetworkOperator.APN_PASSWORD_MATRIX;
        } else if (networkName.toLowerCase().indexOf("xl")!=-1) {
            result = NetworkOperator.APN_PASSWORD_XL;
        } else if (networkName.toLowerCase().indexOf("telkomsel")!=-1) {
            result = NetworkOperator.APN_PASSWORD_SIMPATI;
        }
        return result;
    }
}

 

 

And these article should help about how to use the APN:

 

http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-con...

 

http://supportforums.blackberry.com/t5/Java-Development/Specify-APN-information-for-a-direct-TCP-con...

Developer
Posts: 52
Registered: ‎11-21-2009
My Device: Not Specified

Re: Indonesia HTTP connection ?

Thank you for your reply.

 

How much is gonna cost those users to use the APN ? I agree that a popup should comes out prevent users that extra money will cost them or not to use those APN settings.

 

Another question:

If  users are able to use Internert could that means that the APN setttings are used for those carriers or not ? If yes then no extra money will cost them , if not then a popup should comes out to prevent that : "An extra fair will may cost/ or not by using APN settings. Do you wanna use the APN Settings. For more details about the cost call your carrier . "

 

Thank you.

Developer
Posts: 52
Registered: ‎11-21-2009
My Device: Not Specified

Re: Indonesia HTTP connection ?

Also according these article:

http://supportforums.blackberry.com/t5/Java-Development/how-to-get-APN/m-p/615947

If the user has configured the APN under Options, Advanced Options, TCP, then direct TCP connections will use this APN by default.

 

And now the question:

If i want to make Direct TCP connection with APN settings setup by user in Options, Advanced Options, then my connString = ";deviceside=true";   will be enouth to iniate a HTTP connection  or not  (means that my string should look as 

("socket://yourServer:5445;deviceside=true;apn=internet.com;
tunnelauthusername=user165;tunnelauthpassword=user165password")

)?

 

Thank you in advance.

Developer
Posts: 52
Registered: ‎11-21-2009
My Device: Not Specified

Re: Indonesia HTTP connection ?

According this:

http://supportforums.blackberry.com/t5/Java-Development/retrieving-device-APN-setting-programmatical...

 

If the apn settings were setup on the device then it's enough to use just ;deviceside=true

 


Developer
Posts: 52
Registered: ‎11-21-2009
My Device: Not Specified

Re: Indonesia HTTP connection ?

HI . From where did you get those values for apn settings ? Are they the lastest one ?

I found this link: http://www.cellflarenews.com/blackberry/apn-settings-for-your-blackberry-and-iphone/comment-page-1/ and it seems that your apn settings are different .

Visitor
Posts: 1
Registered: ‎01-05-2011
My Device: Not Specified

Re: Indonesia HTTP connection ?

Hahahahaha