How to use WebView in Offline mode? Can I dynamically revoke permissions?

by Mariano Kamp » Wed, 21 Apr 2010 02:17:51 GMT

Sponsored Links

I am want to use JavaScript to process some HTML pages in the background.

WebView seems to be a great basis to do this. There is one issue though. I
don't want to display the web page and its images/stylesheets right away, so
it is a waste of bandwidth when the stylesheets and images are downloaded. I
am wondering how to tell WebView not to do that.

I tried WebSettings.setLoadsImagesAutomatically(false), but this still loads
the stylesheets. WebView.setNetworkAvailable(false) is more an information
for WebView than a switch. Overriding
WebViewClient.shouldOverrideUrlLoading(..) didn't work either.

Any idea how to do this?

One thing that works is not giving the app the required Internet permission.
Unfortunately it is not that simple, because at other times I want to
display the processed pages and then it should download the
images/stylesheets ;-( But still is there some way that I can use this
permission thing? Can I dynamically revoke the permission? For a single
thread or process?




How to use WebView in Offline mode? Can I dynamically revoke permissions?

by Mariano Kamp » Wed, 21 Apr 2010 03:39:17 GMT


Sounds good. I will try that.


Sponsored Links

Other Threads

1. Two Notifications

How can I send two Notifications to one NotificationManager in a way
that I get only one icon for that NotificationManager? What happens
now is that you get a second icon for the second notification - and a
third, fourth, etc.
I've seen this question before, but I don't think it got answered?

2. "Cannot finish download. There is not enough space."

I've checked the code, and there is no difference whatsoever between
the download code in RC19 and RC28/29/30.

If anyone runs into this issue and has their device configured to run
adb, the following information could help me diagnose what's going on:

-the result of "adb shell df"
-any line output by "adb logcat" that contains the string "DownloadManager".



3. PacMan Game on Android

4. Store audio in SQLite?

5. Pay app support?

6. USING Google's G1 as a MODEM

7. Connect via USB resets prefs