How to call HTTP URL using wifi in J2ME code for BlackBerry 5.0 and above? -


i calling web service blackberry using j2me code. when try open connection using httpconnection, checking gprs connection. now, want check wi-fi connection , call webservice through wi-fi.

the following code connection section. how change code wi-fi connection?

public boolean httpurl()  {     httpconnection conn = null;     outputstream out = null;     string url = "http://www.google.com";     try      {         conn = (httpconnection) new connectionfactory().getconnection(url).getconnection();         if (conn != null)          {              conn.setrequestmethod(httpconnection.post);             conn.setrequestproperty("content-length", "application/x-www-form-urlencoded");             conn.setrequestproperty("content-type", "application/x-www-form-urlencoded");             conn.setrequestproperty("user-agent", "profile/midp-2.0 configuration/cldc-1.0");           }     }      catch (exception e)      {         return false;     }           {         try          {             out.close();         }          catch (exception e2)          {         }     }      //only if exception occurs, close connection.     //otherwise caller should close connection himself.     try      {         conn.close();     }      catch (exception e1)     {     }     return true; } 

check way:

httpconnection conn = null; string url = "http://www.myserver.com/mycontent;deviceside=true;interface=wifi"; conn = (httpconnection)connector.open(url); 

source


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -