Hi all,
I have to port one application from Blackberry to Android
I'm new to Droid and I couldn't find out a simple way to establish a HttpConnection
This is my Blackberry code
Can anyone tell me the Droid way of implementing this in a simplest way like using HttpConnection?
I have to port one application from Blackberry to Android
I'm new to Droid and I couldn't find out a simple way to establish a HttpConnection
This is my Blackberry code
private HttpConnection myConn = null;
private InputStream myIs = null;
public boolean checkWebConnection(String username, String password)
{
myConn = null;
myIs = null;
String thisUrl = Constants.URL+"/ServiceOrders.asmx/CheckWebConnection?TechCode="+username+"&TechPIN="+password;
try{
myConn = (HttpConnection) Connector.open(thisUrl);
myConn.setRequestMethod(HttpConnection.GET);
myConn.setRequestProperty("Connection", "Keep-Alive");
int rc = ((HttpConnection)myConn).getResponseCode();
if(rc != HttpConnection.HTTP_OK){
return false; //throw new IOException("HTTP response code"+rc);
}
myIs = myConn.openDataInputStream();
}
catch(Exception e)
{
Dialog.inform("checkWebConnection()"+e.toString());
}
finally
{
try{
myConn.close();
myIs.close();
}catch(Exception e){}
}
return false;
}
Can anyone tell me the Droid way of implementing this in a simplest way like using HttpConnection?