+ Start a Discussion
AndBuAndBu 

Access the camera via SF1

Hi!
I trying to get access to the camera via SF1, I'm using code below, but when I press on button, I can add only existing photos. 
I'm using Android 4.4.4.
How can I get access to the camera? Maybe I forgot about some settings?
<apex:page docType="html-5.0"   showHeader="false" sidebar="false" standardStyleSheets="false"  contentType="text/html">
 <script type="text/javascript">   
    function previewFile() {
  var preview = document.querySelector('#preview');
  var file    = document.querySelector('input[type=file]').files[0];
  var reader  = new FileReader();
 
  reader.onloadend = function () {
    preview.src = reader.result;
  }
 
  if (file) {
    reader.readAsDataURL(file);
  } else {
    preview.src = "";
  }
}
</script>
<form>
  <input type="file" onclick="previewFile()" />
 
<h1>Preview</h1>
 <div style="height:200px">
  <img src="" id="preview" height="200" alt="Image preview..." />
 </div>
</form>
</apex:page>

 
Hargobind_SinghHargobind_Singh
Seems like there is a known issue for Android 4.2+, check here: https://success.salesforce.com/issues_view?id=a1p30000000T3MFAA0

 
bob_buzzardbob_buzzard
The ability to access the camera was removed from the chromium web view in Android 4.4 - you can read the full details at:

https://issues.apache.org/jira/browse/CB-5294
AndBuAndBu
Thanks for replies!