Why must WebView display local files via a ContentProvider?

by Biosopher » Thu, 06 Nov 2008 02:02:54 GMT


Sponsored Links
 In case you hadn't heard, WebView won't display local files directly
via loadUrl("file://YOUR_PATH/file.html).  All the solutions create a
ContentProvider to access the local files and send them to a WebView
using ContentProvider.openFile().

This approach seems less secure than simply sending my locally created
application files files directly to WebView.  My app creates and
stores the files in my sandboxed local file directory so they should
be inaccessible to anyone and thus secure.

I know the standard response for why this is:  "That WebView's access
to local files would be insecure".

But why is it safer to wrap files into a ContentProvider and then feed
them to WebView when the purpose of a ContentProviders is mostly to
share content between apps.. .which I won't be doing?

So my questions:
1) What was wrong with the local file solution for WebView.loadUrl().
2) Why is it safer to wrap my local files into a ContentProvider?

Thanks,
Anthony
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Email Application notification sound lost after reboot

Greeting group.

I recently replaced the SD Card in my Droid 2 with a 32 GB card. I
transfered the data from the old card to the new one by taring the
entire content to a host then replaced the card with the new one and
untared the files. For the most part things worked fine. I had to re-
configure my custom notification in a couple of applications. I am
having trouble with the stock Email application. I set the ringtone
notification and it works fine, until I reboot. On reboot it goes back
the the default Droiiiid. The only thing I can think of is that the
new SD Card takes longer to mount and it is not available when Email
comes up thus Email can't find the sound file. Anybody out there
having this issue? Better yet, any solution to overcome this?

Thanks.

-- 

2. Handset time synchronization

I am working on a project that requires the time on multiple handsets
be as close to one another as possible (10 milliseconds or better). Is
this even possible? is that precision possible with the GPS in most
android phones?

The path I am going down now is:
1. All Handsets on local wifi network (just as a proof of concept,
will allow cell network later if quick enough)
2. local NTP server on that local network to provide the "base time"
all handset should aim for.
3. create a service that will poll the NTP server every X seconds (or
minutes if drift isn't that bad).

I have looked around the group but have not found an answer yet.

3. Building Robotium

4. Neighboring Cell Information

5. Proxy Authentication Issue

6. Graph using rgraph

7. Android with NFC in the market