【问题标题】:BlackBerry - Connection problem using WAP2BlackBerry - 使用 WAP2 的连接问题
【发布时间】:2010-01-30 08:35:40
【问题描述】:

我正在尝试建立与以下网址的连接:

http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=0KOmkJ7V34Hvfo6oPV4YJaKmTz69b_UMMhOyBex5v24Gnyr3t4lrN26HBjwbfT.khg--&query=pepsi&latitude=37.79581&longitude=-122.38008&results=5

问题是,当我尝试使用 WAP2 连接到上述 url 时,我得到的连接为 null,另一方面,当我在 WIFI 上建立连接时,我能够建立连接并获得正确的响应。

附加:

";ConnectionUID=WAP2Trans" 到上述网址不起作用。(将连接设为空)

同时

追加

";interface=wifi" 到上面的网址有效。

我获取 ConnectionUID 的逻辑是:

ServiceBook sb = ServiceBook.getSB();
   net.rim.device.api.servicebook.ServiceRecord[] records = 
      sb.findRecordsByCid("WPTCP");
   String uid = null;
 /*System.out.println("*****************Records are :" + records);
   System.out.println("*****************Records length :" + ecords.length);*/
   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].getCid().toLowerCase().indexOf("wptcp") != -1) && 
               records[i].getUid().toLowerCase().indexOf("wap2") !=- 1 &&
               (records[i].getUid().toLowerCase().indexOf("wifi") == -1) &&
               (records[i].getUid().toLowerCase().indexOf("mms") == -1)) {
               uid = records[i].getUid();
               break;
            }
         }
      }
   }
   if (uid != null) {
      url = url +";ConnectionUID=" + uid;
   }

【问题讨论】:

    标签: networking blackberry connection wap


    【解决方案1】:

    试试这个

    url = url +";deviceside=true;ConnectionUID=" +uid;
    

    【讨论】:

    • 嗨..谢谢回复...试过了,但没有用...似乎是沃达丰的问题,因为它正在其他运营商上工作..
    【解决方案2】:

    你不应该试试

    records[i].getUid().toLowerCase().indexOf("wap2") != -1 &&
    

    而不是

    records[i].getUid().toLowerCase().indexOf("wap2") !=- 1 &&
    

    检查 -1 而不是 =- 1

    让我知道这是否有效

    【讨论】:

    • 嗨...我的这段代码之前工作过..我的连接或 VodaFone 似乎有问题..感谢回复..
    【解决方案3】:

    我认为是因为这个条件: (records[i].getCid().toLowerCase().indexOf("wptcp") != -1)

    您之前是通过 WPTCP 过滤的: 记录 = sb.findRecordsByCid("WPTCP");

    所以我猜循环中的所有记录都会有 Cid 到 WPTCP

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-16
      • 2021-12-03
      • 2011-06-11
      • 1970-01-01
      相关资源
      最近更新 更多