Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaydeepw/2481134 to your computer and use it in GitHub Desktop.
Save jaydeepw/2481134 to your computer and use it in GitHub Desktop.
Getting a connection string while making a network connection in BlackBerry.
// Get most appropriate connection method
private String getConnectionString() {
String suffix = null;
if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS))
{
// BES is available
suffix = ";deviceside=false";
}
else if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_BIS_B))
{
// BIS is available
suffix = ";deviceside=false;ConnectionType=mds-public";
}
else if (RadioInfo.areWAFsSupported(RadioInfo.WAF_WLAN) &&
CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT, RadioInfo.WAF_WLAN, false))
{
// wifi is available
suffix = ";deviceside=true;interface=wifi";
}
else if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT)) {
// attempt to use direct tcp connection
suffix = ";deviceside=true";
}
return suffix;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment