Timer and DefaultHttpClient
<p>I want to receive json string every minute from https server. Emulator works nice, but on device my widget stops to update info (ignores new json strings) after about 30 minutes. First 30 minutes widget works perfectly.</p>

<p>Timer:</p>

<pre><code>public void run() {
        client = new RestClient("https://example.com/check_messages_new.php");      
        if (userName != null)
        {
            client.AddParam("user", userName);
            client.AddParam("output", "json");

            try {
                client.Execute(RequestMethod.GET);
            } catch (Exception e) {
                connect = false;
                e.printStackTrace();
            }
        }
</code></pre>

<p>RestClient.Execute():</p>

<pre><code>    response = new String[3];
    response[0] = "0";
    Log.d(LOG_TAG, "response[0] set to 0");

    HttpParams httpParameters = new BasicHttpParams();

    // Set the timeout in milliseconds until a connection is established.
    int timeoutConnection = 5000;
    HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);

    // Set the default socket timeout (SO_TIMEOUT) 
    // in milliseconds which is the timeout for waiting for data.
    int timeoutSocket = 25000;
    HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);


    HttpClient client = new DefaultHttpClient(httpParameters);
    //HttpConnectionParams.setConnectionTimeout(client.getParams(), 25000);         

    HttpResponse httpResponse;

    try {
        httpResponse = client.execute(request);

        responseCode = httpResponse.getStatusLine().getStatusCode();
        message = httpResponse.getStatusLine().getReasonPhrase();

        HttpEntity entity = httpResponse.getEntity();

        if (entity != null) {

            InputStream instream = entity.getContent();
            response = convertStream(instream);

            // Closing the input stream will trigger connection release
            instream.close();
        }

    } catch (ClientProtocolException e)  {
        response[0] = "0";
        client.getConnectionManager().shutdown();
        e.printStackTrace();
    } catch (IOException e) {
        response[0] = "0";
        client.getConnectionManager().shutdown();
        e.printStackTrace();
    }
}
</code></pre>

<p>Thanks for help</p>
