Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
文件下载在BlackBerry上的非WiFi网络上不起作用_Blackberry_Download_Blackberry Eclipse Plugin - Fatal编程技术网

文件下载在BlackBerry上的非WiFi网络上不起作用

文件下载在BlackBerry上的非WiFi网络上不起作用,blackberry,download,blackberry-eclipse-plugin,Blackberry,Download,Blackberry Eclipse Plugin,我正在尝试使用以下代码下载一个zip文件 HttpConnection httpConn = null; InputStream inStream = null; int responseCode = 0; String connParams = " ;interface=wifi;deviceside=true;"; httpConn = (HttpConnection) Connector.open(src + connParams); responseCode = httpConn.

我正在尝试使用以下代码下载一个zip文件

HttpConnection httpConn = null;
InputStream inStream = null;
int responseCode = 0;

String connParams = "  ;interface=wifi;deviceside=true;";
httpConn = (HttpConnection) Connector.open(src + connParams);

responseCode = httpConn.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
    throw new IOException("Response: " + responseCode);
}

// Other relevant code
这样,当使用
接口=wifi时;deviceside=true,工作正常。这意味着我必须依赖WiFi网络。但是我想使用2G/3G链接下载文件。为此,我在删除
interface=wifi后尝试了相同的代码连接参数。但是它抛出了
IOException:tunnel失败了
exception

请指导我如何在非WiFi网络上工作

我在以下环境中发展

  • BlackBerry JDE Eclipse插件1.5.0
  • 黑莓操作系统4.5
  • 黑莓黑体手机配3G卡

    • 在BlackBerry 4.5上,您仍然需要担心在连接字符串的末尾添加后缀

      interface=wifi;deviceside=true;
      
      如果您只想使用Wi-Fi连接,则为有效的连接字符串后缀。有关支持BlackBerry支持的许多其他类型传输的更多信息,请参见我的(2)答案。在一个答案中,我指给你黑莓网站上的链接


      在另一个答案中,我发布了一些示例代码,其中包含选择传输的算法,并为该传输创建连接字符串后缀。请参阅
      getWifiConnection()
      getBesConnection()
      getSimConnection()
      等方法,以获取正确后缀的示例。

      好吧,我以前遇到过这个问题,我决定进行一些处理,以了解最佳连接类型,下面是我使用的代码:


      请参考已尝试过的。结果相同;例外。