Forums Register Login

Can Android web apps access content:// URLs?

3
+Pie Number of slices to send: Send
Part of one Android app that I have written is a custom content provider that basically stores JPEG images. Using the native ImageView widget, I can specify its "image URI" to a content URL that is handled by my content provider's openFile override.

Is an Android web app also able to access content:// URLs via, for example:

That might be wishful thinking, but at least conceivably the app could use the native functionality-bridging technique of PhoneGap to expose data at content URLs to the web app. Maybe this has been done already.
2
+Pie Number of slices to send: Send
You've had these questions brewing for sometime haven't you Daniel. I have to admit I don't know the answer to this one, but I'll definitely investigate. My gut feel is that in a PhoneGap wrapped application might be able to, but in a web app presented through the browser might not.

Is the application you have built available in the Marketplace? If not, I'll put together a test app at some stage and test for both situations.

Cheers,
Damon.
+Pie Number of slices to send: Send
 

Damon Oehlman wrote:You've had these questions brewing for sometime haven't you Daniel.



Yes

Damon Oehlman wrote:Is the application you have built available in the Marketplace? If not, I'll put together a test app at some stage and test for both situations.



Unfortunately my app is not available in the Marketplace just yet.

Since I have the app, I will also try to code up a test PhoneGap app to access one of the content provider images from HTML. It might take me a bit of time, though.
1
+Pie Number of slices to send: Send
 

Daniel Trebbien wrote:Since I have the app, I will also try to code up a test PhoneGap app to access one of the content provider images from HTML. It might take me a bit of time, though.



Interesting! I checked with Android 2.3 and the HTML img tag is able to pull an image from my custom content provider.

I set up a basic PhoneGap-based app and added an img tag to the main HTML file, setting its image URI to the content URL of one of the images that are managed by my custom content provider. The correct image showed up on the screen, indicating that the HTML engine is able to retrieve files at content URLs.

What remains to be seen is whether the HTML engines of older API levels also support this and whether the Javascript engine can also access files at content URLs (e.g. with XMLHttpRequest).
1
+Pie Number of slices to send: Send
 

Daniel Trebbien wrote:Interesting! I checked with Android 2.3 and the HTML img tag is able to pull an image from my custom content provider.



Awesome Daniel, I think is a good example of how you can really use web and native together for writing apps for Android. Did the same situation work for the HTML just running through the browser?
+Pie Number of slices to send: Send
 

I checked with Android 2.3 and the HTML img tag is able to pull an image from my custom content provider.


Thanks for sharing the findings!
+Pie Number of slices to send: Send
 

Damon Oehlman wrote:Did the same situation work for the HTML just running through the browser?



Yes:

+Pie Number of slices to send: Send
It also works with Android 1.5:

+Pie Number of slices to send: Send
Daniel,
That'a a very nice feature discovered !
But that's mean you create a close binding between your local device and the Web App, however let's stay pragmatic I will help in many situations.
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3358 times.
Similar Threads
degrading
Is it possible to build a native GUI within an Android web app?
database data -to-> List view, how
Analogue clock
How to handle screen orientation changes
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 01:36:24.