Develop a Windows Phone QR Scanner

Hello everybody today we will talk about how to implement a QR scanner on windows phone, this feature is one of the easiest ways and functions to deliver content to the users easier.

What is the QR & Barcode Scanner

Barcode Scanner & QR Scanner is completely helpful. Change your smartphone into a powerful QR Code, Barcode, and Data Matrix scanning utility. Open the app, point the camera at the code and you’re done! By using the phone’s camera, Barcode Scanner will quickly scan and recognize the information of barcode.

How to use a QR , Barcode reader

To scan a QR code simply open the app, point the camera at the code, and you’re done! There is no need to take a photo or press a button. QR Code Reader will automatically recognize any QR code your camera is pointing at.

When scanning a QR code, if the code contains a website URL, you will automatically be taken to the site. If the code just contains text, you’ll immediately see it. For other formats such as phone numbers, email addresses, or contact info, you will be prompted to take the appropriate action.


How to Implement a QR reader at Windows Phone

we will use obtical reader library

The Optical Reader Library attempts to address these issues: it provides an optical code reading Task that is easy to integrate and simple to use, that is already optimized to use the best camera parameters for different devices, and which can be extended to support different image preprocessing and optical code decoders if needed.

follow below steps to implement this library

  • declare an object from the lib after downloading and inserting it in the reference
private OpticalReaderLib.OpticalReaderTask _task = new OpticalReaderLib.OpticalReaderTask(); 
private OpticalReaderLib.OpticalReaderResult _result = null;

  • At the constructor add the event handler function name to the _task object
_task.Completed += OpticalReaderTask_Completed;
  • Implement the function as you looking for in your application, in the below we direct to a URL, so you will declare a string to store the url to it and navigate to this URL  
private void OpticalReaderTask_Completed(object sender, OpticalReaderLib.OpticalReaderResult e)
             _result = e;
                         NavigationService.Navigate(new Uri("/WebViewPage.xaml?url="+_result.Text, UriKind.Relative));

  • Create a button and add  _task.Show(); in the button action to enable the app to open the camera and scan the QR.
  • Don’t forget to dispose thetask when the user click on the back button after opening the camera.

Please find the source code for C# and Xaml here


One thought on “Develop a Windows Phone QR Scanner

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s