shanabus
shanabus

Reputation: 13115

Can you launch the native Camera App from an Html 5 Web App?

I have a mobile website that allows users to upload photos using the file input type (Browse button). If possible, I would like to launch the Camera App of an Android device on click of the Browse button or any other HTML button. Is this possible?

I read this similar post but in their example they are asking how to register the Camera App as Intent Receiver for uploading images. Similar to that, I just want to launch the Camera App in the same way the Android browser picks up on Phone Number and Addresses.

Upvotes: 40

Views: 75697

Answers (3)

elle0087
elle0087

Reputation: 911

if someone need, i'm using the confirmed answer on asp.net. i added to asp.net control the attributes accept="image/*" capture="camera"

<asp:FileUpload ID="FileUpload1" runat="server" type="file" accept="image/*" capture="camera" />
<asp:ImageButton ID="bt_AttUp" runat="server" onClick="bt_AttUp_Click" />

and on .net server side

FileUpload1.SaveAs("PathDestination")

Upvotes: 2

paaacman
paaacman

Reputation: 3012

I tried this:

<input type="file" accept="image/*" capture="camera" />

from here: https://coderwall.com/p/epwmoa

With my Galaxy S2 phone (on Chrome).

It's working and open directly the camera.

Upvotes: 28

Walter K
Walter K

Reputation: 1471

Android 3.0 Honeycomb added Device API support. Google I/O 2011 presentation shows an example on slide 30:

<input type="file" accept="image/*;capture=camera">

It also points to a test site that not surprisingly does not do much on my Froyo phone.

Anybody with a tablet tried it and can tell us what it does and does not do?

4.0 Icecream Sandwich was announced. Code drop may not happen for several months or longer and actual devices may show in the market around Christmas. As to Icecream on current generation of Froyo / Gingerbread phones, official ODM/carrier 4.0 releases will never happen? I'd love to be proved wrong on this. Any word from custom ROMs community?

Upvotes: 52

Related Questions