0

I am trying to access camera from a android phone by vf page.. But is not working. It is asking me to select pic from gallery. It is working fine in iphone. Is there any work around..

<apex:page controller="CameraAccess2" standardStylesheets="false" showHeader="false" docType="html-5.0">
    <apex:form >
    Enter File Description
    <p>
        <apex:inputText value="{!AttachmentName}" />
        <apex:inputFile value="{!attachmentObj.Body}"  accept="image/*;capture=camera" />
    </p>
    <p>
        <apex:commandButton  action="{!saveFile}" value="Save File" />
    </p>
    </apex:form>
</apex:page>

Apex class
-------------------------------------------------------------------------------------------------------------------------------------------------------------
public class CameraAccess{
    public Attachment attachmentObj {get;set;}
    public String AttachmentName {get;set;}
    public CameraAccess() {
    attachmentObj = new Attachment();
    }     

    public PageReference saveFile()
    {
    attachmentObj.ParentId = '003J000000wGwBR';
    attachmentObj.Name = AttachmentName +'.jpg';
    insert attachmentObj;
    return new PageReference('/003J000000wGwBR');
    }
}

1 Answer 1

1

Here are three related SF.SE posts that come up related to accessing the camera in SF1 mobile that you may find helpful:

Use Salesforce1 mobile app to access camera

How can I access to the Android camera directly from Salesforce 1

Salesforce 1 Android Open Camera

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .