Navigate to the URL/URI embedded within the QR Code

Apr 17, 2014 at 8:32 PM
Hi guys,

It's my first time using ZXing for Windows Phone, and I've come across a bit of a problem.

I'm using Nokia developers solution for my ZXing barcode scanner, it works great with QR Codes, the current solution vibrates the phone and outputs a string that contains the content within the QR code, however I want it to actually do two things, as separate functions of course
  1. Open a web browser page and Navigate TO the URL assigned after being successfully scanned, as opposed to just display a string, also is it possible to open a web browser in-app? Similar to how Facebook opens links in-app and provides you with the option to "open in browser" i.e. "Open in safari" if you are using an iPhone.
  2. Upon successful scan, navigate to another page in-app i.e. from BarCodePage.xaml to OtherRandomPage.xaml, I tried using NavigationService but that didn't work.
I'm not sure about the syntax for both of these, could any one help me? This is the current code I have:
void _bcReader_ResultFound(Result obj)
            {
                // If a new barcode is found, vibrate the device and display the barcode details in the UI
                if (!obj.Text.Equals(tbBarcodeData.Text))
                {
                    VibrateController.Default.Start(TimeSpan.FromMilliseconds(100));
                    tbBarcodeType.Text = obj.BarcodeFormat.ToString();
                    tbBarcodeData.Text = obj.Text;
                }
            }
Apr 22, 2014 at 12:20 AM
Is anybody available to help? I just want to know the syntax for how to open a web browser page at the very least by scanning the QR code first on Windows Phone 8?
Coordinator
Apr 23, 2014 at 7:05 PM
That's not a question especially related to ZXing.Net. There are other online ressources which are a better source for such general questions.
I did a little search for you with google and found a solution at MSDN:
How to use the web browser task for Windows Phone 8

Perhaps you have to do a little pre-processing before you use the result of the sanning process. There is a ResultParser class in zxing which gives
you a parsed result of the raw content if it is embedded in a supported format (like vEvent, vCard, URL, etc.):
void _bcReader_ResultFound(Result obj)
{
   // If a new barcode is found, vibrate the device and display the barcode details in the UI
   if (!obj.Text.Equals(tbBarcodeData.Text))
   {
      VibrateController.Default.Start(TimeSpan.FromMilliseconds(100));
      tbBarcodeType.Text = obj.BarcodeFormat.ToString();
      tbBarcodeData.Text = obj.Text;
      var parsedResult = ResultParser.parseResult(obj) as URIParsedResult;
      if (parsedResult != null)
      {
         // do something with ((URIParsedResult)parsedResult).URI
      }
      else
      {
         // perhaps try the raw content of obj.Text with the WebBrowserTask 
      }
   }
}