views:

217

answers:

2

I am trying to establish connection to following url :

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

The problem is that when i am trying to make an connection to above url using WAP2 i am getting connection as null , on the other hand i am able to establish connection and getting correct response when i am making connection on WIFI.

appending :

";ConnectionUID=WAP2Trans" to above url doesn't work.(getting connection as null)

while

appending

";interface=wifi" to above url works.

My logic for getting ConnectionUID is :

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;
   }
+2  A: 

try this

url = url +";deviceside=true;ConnectionUID=" +uid;
Vivart
Hi..Thanx for the reply...Tried this but didn,t work...Seems to be a problem with VodaFone as it is working on other carriers..
tek3
+1  A: 

Shouldn't you try

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

instead of

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

check the -1 and not =- 1

Let me know if this works

gmatthew
Hi...this code of mine was working earlier..It seems that there is some problem with my connection or with VodaFone..neways thanx for the reply..
tek3