How do I pause Flash content in an Android WebView when my activity isn’t visible?

I don’t see where you see that BrowserActivity or anything is calling pauseTimers(). I do see where onPause() for BrowserActivity eventually routes to onPause() of WebView. However, onPause() of WebView has the @hide annotation and so is not part of the SDK. Off the cuff, it would seem like onPause() is what you want, given the comment:

Call this to pause any extra
processing associated with this view
and its associated
DOM/plugins/javascript/etc. For
example, if the view is taken
offscreen, this could be called to
reduce unnecessary CPU and/or network
traffic. When the view is again
“active”, call onResume().

Note the reference to “plugins”, which is not mentioned in the pauseTimers() documentation.

I’d try using reflection to see if onPause() (and later onResume(), when you want stuff to start up again) does what you need. If it does, please post an issue to b.android.com about this, asking them to add these methods (or equivalents) to the SDK. Your requirement seems like it will be a common one, and a solution that goes past the SDK is not a good solution.

Leave a Comment