<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Android:  Using Intents with Intel XDK Buttons in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Android-Using-Intents-with-Intel-XDK-Buttons/m-p/1108211#M71127</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I've downloaded and created an android application with multiple graphic buttons. &amp;nbsp;The idea is to click on a button and have the system prompt for a user to select one of the installed web browsers on the device to open a hard-coded URL. &amp;nbsp;From what I've read the best way to do this is by using Intents but it doesn't seem to work. &amp;nbsp; I can get the default browser to open by specifying&lt;/P&gt;

&lt;P&gt;window.open('http://www.google.ca','_system','location=yes');&lt;/P&gt;

&lt;P&gt;but this is not the desired behaviour. &amp;nbsp; When I select the action for the button and edit script I use the following&lt;/P&gt;

&lt;P&gt;&amp;nbsp;function register_event_handlers()&lt;BR /&gt;
	&amp;nbsp;{&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp;/* graphic button &amp;nbsp;Button */&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; $(document).on("click", ".uib_w_2", function(evt)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* your code goes here */&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String myURL= "http://www.google.ca";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(myURL));&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; intent.setType("application/browser");&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; startActivity(Intent.createChooser(intent, null));&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return false;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; });&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp;document.addEventListener("app.Ready", register_event_handlers, false);&lt;BR /&gt;
	})();&lt;/P&gt;

&lt;P&gt;But this throws a number of errors stating Intent, myURL are not defined and "expected an assignment or function call and instead saw an expression". &amp;nbsp; I'm not sure what I'm doing wrong here. &amp;nbsp;Can someone please advise? &amp;nbsp;I have installed the InAppBrowser for Cordova and &lt;A href="http://*/*" target="_blank"&gt;http://*/*&lt;/A&gt; whitelisted for allowed-intent.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2016 17:14:53 GMT</pubDate>
    <dc:creator>Dan_B_2</dc:creator>
    <dc:date>2016-08-23T17:14:53Z</dc:date>
    <item>
      <title>Android:  Using Intents with Intel XDK Buttons</title>
      <link>https://community.intel.com/t5/Software-Archive/Android-Using-Intents-with-Intel-XDK-Buttons/m-p/1108211#M71127</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I've downloaded and created an android application with multiple graphic buttons. &amp;nbsp;The idea is to click on a button and have the system prompt for a user to select one of the installed web browsers on the device to open a hard-coded URL. &amp;nbsp;From what I've read the best way to do this is by using Intents but it doesn't seem to work. &amp;nbsp; I can get the default browser to open by specifying&lt;/P&gt;

&lt;P&gt;window.open('http://www.google.ca','_system','location=yes');&lt;/P&gt;

&lt;P&gt;but this is not the desired behaviour. &amp;nbsp; When I select the action for the button and edit script I use the following&lt;/P&gt;

&lt;P&gt;&amp;nbsp;function register_event_handlers()&lt;BR /&gt;
	&amp;nbsp;{&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp;/* graphic button &amp;nbsp;Button */&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; $(document).on("click", ".uib_w_2", function(evt)&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* your code goes here */&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String myURL= "http://www.google.ca";&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(myURL));&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; intent.setType("application/browser");&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; startActivity(Intent.createChooser(intent, null));&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return false;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; });&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
	&amp;nbsp;document.addEventListener("app.Ready", register_event_handlers, false);&lt;BR /&gt;
	})();&lt;/P&gt;

&lt;P&gt;But this throws a number of errors stating Intent, myURL are not defined and "expected an assignment or function call and instead saw an expression". &amp;nbsp; I'm not sure what I'm doing wrong here. &amp;nbsp;Can someone please advise? &amp;nbsp;I have installed the InAppBrowser for Cordova and &lt;A href="http://*/*" target="_blank"&gt;http://*/*&lt;/A&gt; whitelisted for allowed-intent.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 17:14:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Android-Using-Intents-with-Intel-XDK-Buttons/m-p/1108211#M71127</guid>
      <dc:creator>Dan_B_2</dc:creator>
      <dc:date>2016-08-23T17:14:53Z</dc:date>
    </item>
    <item>
      <title>To add to this, I've tried</title>
      <link>https://community.intel.com/t5/Software-Archive/Android-Using-Intents-with-Intel-XDK-Buttons/m-p/1108212#M71128</link>
      <description>&lt;P&gt;To add to this, I've tried removing the settype line - unfortunately there's no change in behavior.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 18:00:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Android-Using-Intents-with-Intel-XDK-Buttons/m-p/1108212#M71128</guid>
      <dc:creator>Dan_B_2</dc:creator>
      <dc:date>2016-08-23T18:00:28Z</dc:date>
    </item>
  </channel>
</rss>

