<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flexpert to the rescue &#187; Android</title>
	<atom:link href="http://www.flexpert.be/tag/android/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexpert.be</link>
	<description>Blog site about all things Adobe</description>
	<lastBuildDate>Sun, 05 Feb 2012 21:58:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Detecting the network connection type with Flex 4.5</title>
		<link>http://www.flexpert.be/2011/04/detecting-the-network-connection-type-with-flex-4-5/</link>
		<comments>http://www.flexpert.be/2011/04/detecting-the-network-connection-type-with-flex-4-5/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 08:47:42 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[BlackBerry PlayBook]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[3G]]></category>
		<category><![CDATA[Flex 4.5]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[permissions]]></category>
		<category><![CDATA[WiFi]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=834</guid>
		<description><![CDATA[As you may already be aware of, Flex 4.5 is the next version of Flex that is also optimised for mobile development. That means that you can create compelling Rich Internet Applications with the Flex framework and deploy them on mobile Android devices, as well as the BlackBerry PlayBook (and [...]]]></description>
			<content:encoded><![CDATA[<p>As you may already be aware of, Flex 4.5 is the next version of Flex that is also optimised for mobile development. That means that you can create compelling Rich Internet Applications with the Flex framework and deploy them on mobile Android devices, as well as the BlackBerry PlayBook (and iOS devices in the near future).</p>
<p><strong>One of the great features of mobile RIAs is the fact that you can connect your application to all kinds of different server technologies, such as PHP, Java, ColdFusion, .NET, &#8230; in exactly the same way as you would in your desktop AIR application.</strong> You can even work with the DataService component to use real-time data connections over the RTMP channel. Just think about real-time stock updates, video streaming, trader applications on mobile, collaboration across multiple devices &#8230; The sky really is the limit. Or is it?</p>
<p>I think all of this always sounds very nice, but <strong>people tend to forget one important thing when working on a mobile device and that is that if you&#8217;re not on a WiFi connection, your data contract can become very expensive when you use the sever connections</strong>. However, in Flex 4.5 there is a way to actually check whether you are working on your data contract or on a WiFi connection.</p>
<p>In the application <strong>you can access all of the device interfaces and check to see whether they are active or not</strong>. The only thing you need to know is which interface to look for. In the code below, you can see how I check for the &#8220;WiFi&#8221; and &#8220;mobile&#8221; interfaces. Based on what I find, I just check whether it is active. Remember, some people may have the possibility to work via a data contract, but didn&#8217;t sign up for it, so finding the &#8220;mobile&#8221; interface isn&#8217;t enough.</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:View</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">		xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #000000;">		title=<span style="color: #ff0000;">&quot;Connection Test&quot;</span></span>
<span style="color: #000000;">		creationComplete=<span style="color: #ff0000;">&quot;initView()&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			private function initView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				var interfaces:Vector.&lt;NetworkInterface<span style="color: #7400FF;">&gt;</span></span> = NetworkInfo.networkInfo.findInterfaces();
&nbsp;
				for(var i:uint = 0; i <span style="color: #000000;">&lt; interfaces.length; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">					if<span style="color: #66cc66;">&#40;</span>interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.name.toLowerCase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;wifi&quot;</span> &amp;&amp; interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.active<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">						lbl.text = <span style="color: #ff0000;">&quot;WiFi connection enabled&quot;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">					<span style="color: #66cc66;">&#125;</span> else if<span style="color: #66cc66;">&#40;</span>interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.name.toLowerCase<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #ff0000;">&quot;mobile&quot;</span> &amp;&amp; interfaces<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.active<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">						lbl.text = <span style="color: #ff0000;">&quot;Mobile data connection enabled&quot;</span>;</span>
<span style="color: #000000;">						break;</span>
<span style="color: #000000;">					<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;lbl&quot;</span> horizontalCenter=<span style="color: #ff0000;">&quot;0&quot;</span> verticalCenter=<span style="color: #ff0000;">&quot;0&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:View</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>In this example I&#8217;m simply setting the <em>text</em> property of a label, but you can also use this in a real world application to determine the update rate for your server data, for example.</p>
<p>There is one thing you should not forget to do when creating such an application. <strong>You have to set the proper permissions in the &lt;applicationName&gt;-app.xml file, in the android section.</strong> That section should contain the <em>ACCESS_NETWORK_STATE</em> and the <em>ACCESS_WIFI_STATE</em> permissions in order for it to work. If you don&#8217;t include this, you will get an empty <em>Vector</em> returned from the <em>findInterfaces</em> method.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;android<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifestAdditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">	&lt;manifest&gt;</span>
<span style="color: #339933;">		&lt;!-- See the Adobe AIR documentation for more information about setting Google Android permissions --&gt;</span>
<span style="color: #339933;">		&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;</span>
<span style="color: #339933;">		&lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot;/&gt;</span>
<span style="color: #339933;">		&lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot;/&gt;</span>
<span style="color: #339933;">	&lt;/manifest&gt;</span>
<span style="color: #339933;">]]&gt;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifestAdditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/android<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2011/04/detecting-the-network-connection-type-with-flex-4-5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Applications in AIR on Android</title>
		<link>http://www.flexpert.be/2010/06/applications-in-air-on-android/</link>
		<comments>http://www.flexpert.be/2010/06/applications-in-air-on-android/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 13:14:54 +0000</pubDate>
		<dc:creator>Steven Peeters</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Flash Builder]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[BTicino]]></category>
		<category><![CDATA[domotics]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[solar panel monitor]]></category>

		<guid isPermaLink="false">http://www.flexpert.be/?p=512</guid>
		<description><![CDATA[This time I would like to share a small video with you guys. It&#8217;s about a couple of AIR applications that I&#8217;ve created. The first one in the video is a solar panel monitor application, which monitor the power output of my solar panels at home. This one works over [...]]]></description>
			<content:encoded><![CDATA[<p>This time I would like to share a small video with you guys. It&#8217;s about a couple of AIR applications that I&#8217;ve created. The first one in the video is a solar panel monitor application, which monitor the power output of my solar panels at home. </p>
<p>This one works over the internet as well, since it simply downloads a CVS file every 10 minutes to automatically update the application. The design was made in Illustrator, brought into Flash Catalyst to get the arrow working and finally I took it to Flash Builder to attach the HTTPService that fetches the data. You can read the full implementation in my book <a href="http://www.amazon.com/Flash-Builder-Catalyst-Workflow-Essential/dp/1430228350/ref=pd_rhf_p_t_1" target="_blank">&quot;Flash Builder and Flash Catalyst: The New Workflow&quot;</a> as well, since it&#8217;s one of the many examples in there.</p>
<p>The second application is a remote control for my <a href="http://www.bticino.com" target="_blank">BTicino</a> domotics system. I&#8217;ve been wanting to do this for a very long time now. But up until now I just couldn&#8217;t do it, because you couldn&#8217;t create this thing in Flash Lite 3. But now, with AIR on Android (and soon on other mobile platforms as well) I could create a socket connection to my MH200 controller and feed it directly with my input to control the shutters and lights. Naturally, the possibilities are only limited by your imagination.</p>
<p>Both applications are Flex 4 applications, which proves that, despite the fact that the Flex framework isn&#8217;t optimised for these mobile devices and Slider (special Flex framework for mobile) isn&#8217;t yet available, the application still works pretty damn well. Loading times are not that bad either. Imagine what an optimised Flex framework will be able to perform then&#8230;</p>
<p><center><br />
<script type="text/javascript">
    		var parameters =
    			{	id: "1"
    			,	src: "http://www.flexpert.be/tutorials/AIRonAndroid/AIRonAndroid.f4v"
    			,	autoPlay: "false"
    			,   width: "360"
    			,   height: "299"
				,	autoHideControlBar: "false"
				,	controlBarPosition: "bottom"
    			};
    		// Embed the player SWF:
    		swfobject.embedSWF
				( "/strobe/StrobeMediaPlayback.swf"
				, "player"
				, parameters["width"], parameters["height"]
				, "10.0.0"
				, {}
				, parameters
				, { allowFullScreen: "true" }
				, { name: "StrobeMediaPlayback" }
				);		
     </script></p>
<div id="player">
<p>Please install Flash Player 10.0</p>
</p></div>
<p></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flexpert.be/2010/06/applications-in-air-on-android/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

