0

I'm working on a native Google Glass app in Xamarin. I've got QR code scanning working properly - but after a scan I want to open a URL in the Glass browser. Is this something that's possible? The code below just shows that the text was properly scanned. But I really want to open the URL: result.Text.

Any help would be greatly appreciated. Thanks!

Console.WriteLine ("Scanned Barcode: " + result.Text);
var card2 = new Card (this);
card2.SetText ("Card Scanned.");
card2.SetFootnote ("Just scanned!");
SetContentView (card2.ToView());
Zach Johnson
  • 23,678
  • 6
  • 69
  • 86

2 Answers2

0

You can define a new menu item with the following intent.

Intent i = new Intent(Intent.ACTION_VIEW);
                i.setData(Uri.parse(result.Text));
                startActivity(i);
Chirag
  • 335
  • 2
  • 3
  • 13
0

Yes, you can open a URL in the Glass browser.

If result.Text is a URL (like "http://www.stackoverflow.com"), this will work:

Intent i = new Intent(Intent.ACTION_VIEW);
i.setClassName("com.google.glass.browser", "com.google.glass.browser.WebBrowserActivity");
i.setData(Uri.parse(result.Text));
startActivity(i);
Mark Scheel
  • 2,963
  • 1
  • 20
  • 23