Search code examples
google-glassgoogle-gdk

Open a url from a gdk card or invoke the browser


I'm trying to select a url from a card to be opened by the glass browser. Is there a way to set or invoke this?

The Card API for 'getting a uri' from my examination is for rendering images. https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/Card#getImage(int)


Solution

  • You can open a URL in the built-in browser by starting an activity with an ACTION_VIEW intent. For example:

    String url = "http://www.whatever.com";
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));
    startActivity(intent);