Hi
I have a thread which calls a https url and retrievs data after a specified period of time. I have started the thread in the alternate entry so that even if the device is rebooted the thread starts runnnig up (setting the app as device module and startup on reboot).
The app works works fine when i open up the app the thread runs, i kept the network covrage to OFF and put it ON again it still runs.
But once i close the simulator and on startup of the simulator i keep the network coverage to OFF, then the thread runs but the data is not retrieved from the server .
I have the httpGet method as under:
Code:
public String httpRequest(String url) throws IOException
{
System.out.println(url);
String result = null;
HttpsConnection conn = null;
InputStream input = null;
try
{
if( url != null && url.trim().length() > 0)
{
conn = (HttpsConnection)Connector.open(url+";EndToEndDesired");
System.out.println("Conn response "+ conn.getResponseMessage());
if(conn.getResponseCode() == HttpsConnection.HTTP_OK)
{
input = conn.openInputStream();
byte[] data = new byte[256];
int len = 0;
StringBuffer raw = new StringBuffer();
while(-1 != (len = input.read(data)))
{
raw.append(new String(data, 0, len));
}
result = raw.toString();
}
}
} catch(IOException e) {
System.out.println(e.toString());
throw e;
} finally {
try
{
if(input != null)
{
input.close();
}
} catch (IOException e){}
try
{
if (conn != null)
{
conn.close();
}
} catch (IOException e){}
}
System.out.println(result);
return result;
}
The statement
Code:
conn = (HttpsConnection)Connector.open(url+";EndToEndDesired");
System.out.println("Conn response "+ conn.getResponseMessage());
Never returns anything. Does anyone have any idea.
Thanks