1

Does the Salesforce1 App have the ability to access a device's camera to perform a scan in real time using zxing or some similar library?

I understand that there is a method to "read" a barcode using a static image. However this is not a desirable solution for me. Please see this question for further details on that.

I created a native Android app that uses zxing to capture barcode information and create a url with parameters, however I had to abort this because I was unable to get the url parameters to Salesforce1 using a deep link.

My requirement is to scan a barcode, store the information and auto populate a Visualforce page in Salesforce1 based on the information scanned. Within my native app I was able to successfully scan a barcode, construct a url with parameters and populate a Visualforce page on the actual Salesforce site (https:///apex/Barcode_Scanner_Page?item=b5xU000000085ot). But the deep link technique (salesforce1://sObject/001D000000Jwj9v/view ) was unable to pass parameters to a Visualforce page.

1

You're not going to be able to use the camera in Salesforce1; it does not have the Camera permission on any devices, as far as I can tell. According to the Window API documentation, you should be able to use getUserMedia in Lightning Experience; you'll just need to write yourself a component that calls the appropriate methods. It's probably time for you to consider moving to Lightning Experience.

  • So once I use getUserMedia to get the camera data, I will need to use an existing library such as QuaggaJS to capture/decode the barcode? – Reticentz Dec 1 '16 at 23:09
  • @Reticentz Yes, that would be the idea. I'm not sure which libraries are supported by Locker Service though, so you might need to do some research. – sfdcfox Dec 1 '16 at 23:10
  • FYI I don't think it's supported: Salesforce1 should support getUserMedia API – Adrian Larson Jun 15 '17 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.