function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
geetha charangeetha charan 

BarcodeScanning with Salesforce MobileSDK

I am trying to develop a Hybrid mobile application with Visualforce pages and Apex to scan a barcode by using the Mobile device camera.

I am facing dificulties to do this.

Can anyone help me?

Thank you.
logontokartiklogontokartik
Can you please let us know specifically where you are having issues? If you want to browse through examples there are many apps built using Mobile SDK for Barcode scanning that you can search on google. 

But here is the one from Salesforce Developer Blogs

https://developer.salesforce.com/blogs/developer-relations/2012/04/bar-code-and-qr-code-scanning-using-the-mobile-sdk.html
geetha charangeetha charan
@logontokartik

Thanks for the reply.

I already went through that link and also i went through the colud hunter app build by the salesforce.

I tried exactly but it didn't work and the plugins they mentioned are outdated. I don't have knowledge on android development.

finally i got a lot of cofusion where should i host the files for doing an Remote hydrid app. 

I had went through the barcodescanner by wildbeast in github (https://github.com/wildabeast/BarcodeScanner) and it contains some plugin.xml and some files.

which file i should use and where should I host those ones ?

I am just building a simple application on click open a barcode scanner scan the code take the result by using visulaforce javascript remoting query for product if avialable show it if not error msg on vf page.




logontokartiklogontokartik
I am not sure what you mean by hosting files, I assume you are ADT tools to build your android application? Using Eclipse and ADT tools you can basically build android app. And in eclipse you have option to run using Android Simulators as well. After you successfully run your app you can make it into apk package that you can install in any phone with Android OS.
geetha charangeetha charan
@logontokartik 
I mean hosting is like where do i keep the files in salesforce as static resources or in the android project. I am using the Eclipse .
In the example that i have went through when trying to create a hybrid application they are just using a single line 
navigator.camera.getPicture(onPicSuccess, onPicFail, { quality: 50});

for taking a pic how does the visualforce page know about that code. In order to work that particular line i believe there should be a plugin or piece of code somewhere which will make vf page to understand to open the camera.

so this is where i am getting confused how is that working.

Gaurav KheterpalGaurav Kheterpal
navigator.camera.getPicture(onPicSuccess, onPicFail, { quality: 50}); -> This is using Cordova that's bundled in the Mobile SDK.  It is not possible to do so on a Visualforce page. 

This is an example of a pure VF approrach for barcode scanning - http://bobbuzzard.blogspot.in/2014/03/reading-barcodes-in-salesforce1.html

I hope this helps.