Thank you Richard, As suggested, I have used the following code snippet in activity.onCreate() method..
final PowerManager pm = (PowerManager) getSystemService(Context. POWER_SERVICE); this.mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Tag"); this.mWakeLock.acquire(); And in onDestroy(), used the following snippet this.mWakeLock.release(); If we use this, can we remove the system settings since this is controlling the system level. android.provider.Settings.System.putInt(getContentResolver(), android.provider.Settings.System.WIFI_SLEEP_POLICY, android.provider.Settings.System.WIFI_SLEEP_POLICY_NEVER); On Tuesday, October 23, 2012 12:59:16 PM UTC-7, RichardC wrote: > > Oops the link should have been to PowerManager: > http://developer.android.com/reference/android/os/PowerManager.html > > On Tuesday, October 23, 2012 8:57:07 PM UTC+1, RichardC wrote: >> >> Why have you not used a WakeLock? >> >> http://developer.android.com/reference/android/os/PowerManager.WakeLock.html >> >> On Tuesday, October 23, 2012 8:50:34 PM UTC+1, vgokila wrote: >>> >>> Hi: >>> >>> During the large file upload, noticed that mobile network is going to >>> sleep mode and it is disconnecting the internet connection. This is causing >>> large file upload/download to failure. >>> Has anyone controlled mobile network connection through programmatically >>> in app. >>> >>> We have also identified that wi-fi also getting disconnected during >>> sleep mode. But we have used the following system settings to never allow >>> sleep mode. >>> >>> android.provider.Settings.System.putInt(getContentResolver(), >>> android.provider.Settings.System.WIFI_SLEEP_POLICY, >>> android.provider.Settings.System.WIFI_SLEEP_POLICY_NEVER); >>> >>> Thanks >>> Veni >>> >> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

