PDA

View Full Version : setTimeout during sleep mode causing frozen/hung Android WebView



debianw
15 Aug 2012, 8:12 PM
Hey,

I just found an issue in Android when I try to run jobs every N minutes using setTimeout. After the phone goes into sleep mode while this timer is executing, and is turned back on / unlocked after a minute or two, the application looks very slow (scrolling, user events tap, swipes, etc), everything looks slow.

I found a link in the Android developers google's group describing kind of the same issue. https://groups.google.com/forum/?fromgroups#!topic/android-developers/qGd1Nejd51I[1-25]

Have you seen this before ?
Which best practices you use to run background jobs ?, like check gps position or do some request every 5 minutes ?

Environment:
- HTC phone with Android 2.3 (API 10).
- Sencha Touch 2.0.1
- Phonegap 1.7 (2.0 tested too).

mitchellsimoens
17 Aug 2012, 12:38 PM
There are events that should get fired (at least for packaged apps) that tell you when things are paused and resumed that you can clear/stop the timeout.