[android-developers] Android cuts off HttpURLConnection when screen timeout occurs.

2012-10-21 Thread LouieLiu
The app I am writing uses a Streaming (REST) api that opens a HttpURLConnection and listens to a response from a server. I use IntentService for this function so it runs in the background. When my LG phone (ICS 4.03) goes dark (screen timeout), it terminates the connection. But it works fine on

[android-developers] Re: Android cuts off HttpURLConnection when screen timeout occurs.

2012-10-22 Thread LouieLiu
I got it. Change WiFi sleep policy to NEVER. Settings.System.putInt(getContentResolver(), android.provider.Settings.System.WIFI_SLEEP_POLICY,android.provider.Settings.System.WIFI_SLEEP_POLICY_NEVER); On Sunday, October 21, 2012 6:20:53 AM UTC-7, LouieLiu wrote: > > The app I am writing