<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>iamcam</title>
	<atom:link href="http://iamcam.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://iamcam.wordpress.com</link>
	<description>Cameron Perry&#039;s mobile &#38; web development blog</description>
	<lastBuildDate>Sun, 19 May 2013 23:45:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='iamcam.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>iamcam</title>
		<link>http://iamcam.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://iamcam.wordpress.com/osd.xml" title="iamcam" />
	<atom:link rel='hub' href='http://iamcam.wordpress.com/?pushpress=hub'/>
		<item>
		<title>iOS Smart App Banner plugin for WordPress</title>
		<link>http://iamcam.wordpress.com/2012/10/01/ios-smart-app-banner-plugin-for-wordpress/</link>
		<comments>http://iamcam.wordpress.com/2012/10/01/ios-smart-app-banner-plugin-for-wordpress/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 18:17:33 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=310</guid>
		<description><![CDATA[<p><a href="http://bit.ly/smartBanner" title="iOS Smart App Banner plugin for WordPress">iOS Smart App Banner plugin for WordPress</a></p><p>I just released version 1.0 of my iOS Smart App Banner plugin for Wordpress. This plugin lets you put a smart app banner at the top of your post or page when an iOS device visits in mobile Safari. It's a great tool for app promotion that makes it very easy for people to find &#38; buy your app in the App Store.</p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=310&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a title="iOS Smart App Banner plugin for WordPress" href="http://bit.ly/smartBanner">iOS Smart App Banner plugin for WordPress</a></p>
<p>I just released version 1.0 of my iOS Smart App Banner plugin for WordPress. This plugin lets you put a smart app banner at the top of your post or page when an iOS device visits in mobile Safari. It&#8217;s a great tool for app promotion that makes it very easy for people to find &amp; buy your app in the App Store.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/310/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=310&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2012/10/01/ios-smart-app-banner-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>An Overview on Providing OAuth for Your Mobile App</title>
		<link>http://iamcam.wordpress.com/2012/09/19/a-note-on-providing-oauth-for-your-mobile-app/</link>
		<comments>http://iamcam.wordpress.com/2012/09/19/a-note-on-providing-oauth-for-your-mobile-app/#comments</comments>
		<pubDate>Wed, 19 Sep 2012 18:19:53 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=301</guid>
		<description><![CDATA[I was recently playing around with an idea &#8211; a proof of concept &#8211; for an mobile app API. If you&#8217;ve never done this before, keep reading. The high-level requirements: A mobile app that you have control over An API you&#8217;re working on Users must be authenticated As I am the app and API owner, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=301&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I was recently playing around with an idea &#8211; a proof of concept &#8211; for an mobile app API. If you&#8217;ve never done this before, keep reading.</p>
<p>The high-level requirements:</p>
<ul>
<li>A mobile app that you have control over</li>
<li>An API you&#8217;re working on</li>
<li>Users must be authenticated</li>
</ul>
<p>As I am the app and API owner, I thought it best and easiest to use a two-legged OAuth implementation &#8211; username &amp; password plus some secret keys (<a href="http://cakebaker.42dh.com/2011/01/10/2-legged-vs-3-legged-oauth/" target="_blank">3-legged vs 2-legged explanation</a>). This is what your users will expect when logging into your app &amp; service. Before you can start, find an appropriate library for your web framework. There are plenty out there, so <a href="http://oauth.net/code/" target="_blank">pick your poison</a>. I&#8217;m familiar and develop relatively quickly with CakePHP, so I went with <a href="https://github.com/seddonmedia/cakephp-oauth-server" target="_blank">seddonmeida cakephp-oauth-server</a>. I&#8217;ll spare you from too much code.</p>
<p>First, you&#8217;ll have to set up an OAuth client in the database. This is for your app and nobody else. Follow your library&#8217;s instructions; you&#8217;ll find out you can&#8217;t read values from the database because they should be hashed. Once you have it installed and are sure it&#8217;s working, you can start the setup. In the CakePHP plugin,</p>
<pre>function some_open_oauth_action(){
    $client = $this-&gt;OAuth-&gt;Client-&gt;add('myapp://register'); //the URL isn't really important in this case
    print_r($client);
}</pre>
<p>Save your <em>client_id</em> and <em>client_secret</em> in a safe place. You&#8217;ll need it in your app. Now, the fun part. You can test this in your browser, but it will work the same way in your app.</p>
<h3>First, Grant the Token</h3>
<p>In OAuth terms, we&#8217;re doing a password type grant with the client_id and client_secret.</p>
<p><a href="https://domain.ext/oauth/token?grant_type=password&#038;client_id=" rel="nofollow">https://domain.ext/oauth/token?grant_type=password&#038;client_id=</a>{SOME20CHARACTERLONGID}&#038;client_secret={some40characterlongsecretkey}&#038;username={username}&#038;password={password}</p>
<p>You&#8217;ll get JSON in return with a few important keys, namely <em>access_token</em> and <em>refresh_token</em>. They will serve as your ID badge for future requests. Keep them around. NB: <em>access_token</em> is used most, but <em>refresh_token</em> has a special place.</p>
<h3>Request Something</h3>
<p>Making a request for protected resources is easy. Assuming your back-end is set up properly, you should be able to run something like this with no problem:</p>
<p><a href="https://domain.ext/oauth/userinfo?access_token=" rel="nofollow">https://domain.ext/oauth/userinfo?access_token=</a>{whateverAccessTokenYouWereGiven}</p>
<p>I know the above URL is at /oauth/, but that doesn&#8217;t mean your entire API has to be handled with your OAuth controller. In practice, you should include your OAuth library as a component of each appropriate controller wherever you&#8217;re accessing the API, or at least secured content.</p>
<h3>Refreshing Your Token</h3>
<p>A lot of services using OAuth aren&#8217;t going to expire your token. Seddonmeida&#8217;s implementation uses an expiration, but in practice doesn&#8217;t actually enforce it; that&#8217;s up to you. In the case you do have an expiring token, it&#8217;s best to refresh your user&#8217;s keys from time to time so they aren&#8217;t &#8220;logged out.&#8221; To get a fresh new token, access our OAuth token action and request a <em>refresh_token</em> grant type using the <em>client_id, client_secret</em>, and the <em>refresh_token</em> you received when first authenticating.</p>
<p><a href="http://domain.ext/oauth/token?grant_type=refresh_token&#038;refresh_token=" rel="nofollow">http://domain.ext/oauth/token?grant_type=refresh_token&#038;refresh_token=</a>{youGotThisAtAuth}&#038;client_id={some20charid}&#038;client_secret={a40charstring}</p>
<h3>A Note About HTTPS</h3>
<p>Make these requests over HTTPS if you have any option at all. Otherwise, HTTP is sending your username and password over in cleartext, which we all know isn&#8217;t a great idea.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/301/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/301/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=301&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2012/09/19/a-note-on-providing-oauth-for-your-mobile-app/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>Focus Follow Mouse and other *nix wonders</title>
		<link>http://iamcam.wordpress.com/2012/02/03/focus-follow-mouse-and-other-nix-wonders/</link>
		<comments>http://iamcam.wordpress.com/2012/02/03/focus-follow-mouse-and-other-nix-wonders/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 16:06:49 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[sysAdmin]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=294</guid>
		<description><![CDATA[Back in the days at the UCSD Center for fMRI, I had the opportunity to get my hands dirty with a few types of *nix systems that most people have never heard of, much less use. My boss was also pretty keen on very specific configurations that he insisted his employees put on their computers [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=294&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Back in the days at the UCSD Center for fMRI, I had the opportunity to get my hands dirty with a few types of *nix systems that most people have never heard of, much less use. My boss was also pretty keen on very specific configurations that he insisted his employees put on their computers for those infrequent times he&#8217;d be on our workstations. For the record, they were:</p>
<ul>
<li>Always use Emacs</li>
<li>Make sure that key to the left of the &#8220;A&#8221; key was your <strong>control</strong> key, map it to control if it wasn&#8217;t already</li>
<li>Make sure focus follows mouse set to enabled.</li>
</ul>
<div>These are no big deal on various *nix systems, but to most Mac people, completely novel ideas</div>
<h3>Caps Lock to Ctrl</h3>
<p>Briefly, that control key thing. I hated it at first. Then I started using Emacs quite a bit and it made sense. It much better on your poor little pinky finger to press down without having to contort your hand. Old Solaris systems actually made that the hardware control key. Any other keyboard has to be remapped via software so &#8220;caps lock&#8221; wasn&#8217;t really caps lock. I highly recommend it, but people are soooo confused when they&#8217;re using my machine and the caps lock doesn&#8217;t work. Or control doesn&#8217;t work and makes all their text in capitals.</p>
<h3>Focus Follows Mouse</h3>
<p>I don&#8217;t know why I forget to do this one. The idea is that window focus (the act of becoming active) can be controlled by simply moving your mouse over the window rather than having to physically click on it and bring the window to the foreground. FFM is particularly handy because the window <em>isn&#8217;t brought to the foreground</em>, but is still takes input from the keyboard. I use this most often when working with the terminal &#8211; where often I only care most about the last several lines of output, and not all the clutter of text and OS UI above it. It leaves the main window that might be referencing right where it is.</p>
<p>On your Mac, open Terminal, and do this:</p>
<pre>defaults write com.apple.terminal FocusFollowsMouse -string YES</pre>
<p>Quit terminal. Re-open, and open a second terminal window (not tab). Hover your mouse over one of them and start typing. Now, hover your mouse over the other one and type. See what happens? If everything worked properly, the typing occurs in the window your mouse is hovered over. The only caveat is that it acts a little funny if the terminal is in the background to another app, but it still works. I found that sometimes you have to hover out &amp; over another app then back to the other term window. Not a huge deal, I guess. Try it out. If you don&#8217;t like it, change the above command from &#8230; YES to &#8230; NO</p>
<p>It&#8217;s a time saver and convenience &#8211; especially useful on constrained displays. You might just fall in love. Now if only the whole OS would let me do that.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/294/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=294&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2012/02/03/focus-follow-mouse-and-other-nix-wonders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>Underwhelming Android Experience</title>
		<link>http://iamcam.wordpress.com/2011/10/17/underwhelming-android-experience/</link>
		<comments>http://iamcam.wordpress.com/2011/10/17/underwhelming-android-experience/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 01:14:26 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iOS]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=285</guid>
		<description><![CDATA[Ryan Heise summed it up nicely in Four Months With Android. I used an HTC incredible for 11 months. There are some great things about Android, but the negatives far outweigh the benefits for me. Android was just underwhelming. The UI and UX isn&#8217;t as nicely polished as iOS. Android apps, on average, just aren&#8217;t [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=285&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Ryan Heise summed it up nicely in <a href="http://dinnerwithandroid.tumblr.com/post/11571096718/four-months-with-android-reflections-grievances-and" target="_blank">Four Months With Android</a>. I used an HTC incredible for 11 months. There are some great things about Android, but the negatives far outweigh the benefits for me. Android was just underwhelming. The UI and UX isn&#8217;t as nicely polished as iOS. Android apps, on average, just aren&#8217;t as well polished. Android reminds me of Windows of years past. Sure, it more or less works, but it&#8217;s just not that great of an experience.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/285/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=285&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2011/10/17/underwhelming-android-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>Will Hybrid Mobile Apps Prevail Over Native?</title>
		<link>http://iamcam.wordpress.com/2011/10/10/will-hybrid-mobile-apps-prevail-over-native/</link>
		<comments>http://iamcam.wordpress.com/2011/10/10/will-hybrid-mobile-apps-prevail-over-native/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 01:29:45 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Reviews and Discussions]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[hybrid]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[PhoneGap]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=273</guid>
		<description><![CDATA[I&#8217;ve been wrestling with this question for some time, and I thought this post may help sort out my thoughts and opinions while giving you some important insight. Are hybrid mobile apps going to become the developer&#8217;s choice anytime soon? The debate can be pretty heated as companies choose one technology over the other. Hybrid, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=273&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been wrestling with this question for some time, and I thought this post may help sort out my thoughts and opinions while giving you some important insight. Are hybrid mobile apps going to become the developer&#8217;s choice anytime soon? The debate can be pretty heated as companies choose one technology over the other.</p>
<h2>Hybrid, the Unlikely Union</h2>
<p>Let&#8217;s get the definitions straight before we begin. A hybrid app is one of those mobile apps that uses a native web view to display HTML, CSS, and JS &#8220;web&#8221; apps. They&#8217;re only sort-of &#8220;web apps&#8221; because they are run locally, though they often pull data from online sources via AJAX requests. So, you have this HTML/CSS/JS app running inside of a natively-compiled stand-alone web browser of sorts on your phone. One such example is <a title="PhoneGap" href="http://www.PhoneGap.com" target="_blank">PhoneGap</a>. Because the logic bits of the app are written using web technologies, you can often develop once and deploy on multiple platforms, so long as you&#8217;re using supported markup. You&#8217;re killing multiple birds with one stone.</p>
<h2>Hybrid is the Bee&#8217;s Knees</h2>
<p>As I mentioned above, hybrid technologies are great for developing cross-platform apps. Seriously &#8211; since iOS, Android, and even some Blackberry devices are both running Webkit most, if not all, your html, css, js is going to work remarkably similarly on both platforms. It&#8217;s pretty enticing. From your and your client&#8217;s perspective it&#8217;s a pretty easy sell. For one round of development you have the potential to hit many more users. It&#8217;s pretty cost-effective. Pretty soon you&#8217;re singing the praises of your decision and you&#8217;ve decided that from now on hybrid apps are the bee&#8217;s knees.<br />
<span id="more-273"></span></p>
<h2>The Gateway Drug</h2>
<p>I&#8217;m not going to lie &#8211; I immediately fell in love with the idea because my background was primarily web development. I can take my existing toolset and apply it just a little bit differently to come up with something like an iPhone app that I&#8217;m sure everyone would want to buy. I&#8217;m getting ahead of myself. If it wasn&#8217;t for tools like <a title="PhoneGap" href="http://www.phonegap.com" target="_blank">PhoneGap</a> and <a title="jQTouch" href="http://jqtouch.com/" target="_blank">jQTouch</a>, it would have been much longer before I got into mobile development. Now there are libraries such as <a href="http://www.sencha.com/products/touch" target="_blank">Sencha Touch</a> and <a href="http://jquerymobile.com/" target="_blank">jQuery Mobile</a> to aid development. It&#8217;s an exciting industry to be working in. It&#8217;s not that the web is old and tired, but mobile development is something new and exciting. I can&#8217;t wait to see where we&#8217;ll be in just a few years from now. It&#8217;s getting <em>that</em> good, that fast.</p>
<h2>Native Apps, the OG Tech</h2>
<p>So far I&#8217;ve been discussing the benefits, and singing the praises of developing hybrid apps. So what about native ones? Since I&#8217;m really only familiar with Cocoa Touch, I&#8217;ll write from the perspective of an iOS developer, though many of these points will apply to Android. There is something to be said about the quality and performance of native apps. Native apps are going to perform better than hybrid apps, no doubt about it. When you read that, you&#8217;ll probably first think about number crunching, but I encourage you to think about it from another perspective: responsiveness. I&#8217;m talking about the speed at which things happen on the screen when you need them to. Does the next view load and transition instantaneously? How about animations or actions attached to button presses? Hybrid frameworks have come a long way, but native still wins this race, hands-down. When your app responds immediately to touch events, that&#8217;s awesome for the users&#8217;s experience because that&#8217;s how apps <em>should</em> work.</p>
<p>I think there&#8217;s also a certain level of sophistication in native apps that can&#8217;t quite be reached by hybrid apps. You can do quite a bit (even impressive) things with html/css/js but it only goes so far. At some point you hit a wall. More on this later.</p>
<h2>Sticking Points</h2>
<p>About a year ago, I chose to switch from jQTouch to Sencha Touch for hybrid app development. Overall, the end results have been very pleasing, especially compared to pre-Sencha Touch days. This framework takes care of most of the heavy lifting, from UI to data management. In many ways Sencha Touch looks and feels very similar to a native app. It mimics many of the same user interface and behaviors as its native cousins on both iOS and Android. It really is the best-of-class frameworks for hybrid apps. Beware, however, that it&#8217;s not an entirely pleasant experience.</p>
<h3>The Mobile Web Darling, Sencha Touch</h3>
<p>I&#8217;ve run into too-many-to-count issues with Sencha Touch relating to tweaking the layout, screen rendering, and general UX problems (I never said it was perfect). I&#8217;ve discussed some of these with fellow developers. Typically I describe it this way &#8211; It&#8217;s not too bad to work with until something that should work out of the box, doesn&#8217;t. I&#8217;ve spent far too many hours trying to debug and fix some very basic problems. Case in point &#8211; rotating the device causes rendering errors. A good number of developers have also experienced some major Android incompatibilities, especially with the HTC Sense UI. Ever seen a text form field duplicate itself elsewhere on the screen when given focus? Work with Sencha on Android long enough and you&#8217;ll see what I mean. There&#8217;s no clear fix for that, nor is that mysterious field controllable by the DOM &#8211; it&#8217;s all at the OS level. How about crashing Android devices when you scroll the screen content too much? Just sayin&#8217;. I will give Sencha some credit, though. Touch works much better on Android than it did a year ago, and many of the most significant problems have been addressed. Also, customizing the UI isn&#8217;t too terrible. Most of the time.</p>
<h3>The &#8220;Others&#8221;</h3>
<p>I&#8217;ve read enough about others&#8217; experiences with jQuery Mobile to know it&#8217;s not up to par like Sencha Touch is. I skipped over it a while ago, and don&#8217;t have immediate plans of working through another framework&#8217;s growing pains just yet. I guess this post isn&#8217;t quite fair enough to Sencha because it&#8217;s really the one I know most about. So let me reiterate &#8211; others have been saying Sencha Touch really is the best one out there. And truth be told &#8211; Sencha Touch can produce some really good apps.</p>
<p>The problem you&#8217;re going to run into with these &#8220;web&#8221; frameworks is going to convince your client and end users that the app is undetectably different than native apps. That means they should be just as fluid and work just as seamlessly as native apps. Most of the time I don&#8217;t see that parity. Animations can be jerky, the UI looks mostly native, but you can tell the difference. When it comes down to it, there are simply things you can&#8217;t do with web technologies that are pretty commonplace with native libraries. It&#8217;s not really JS&#8217;s fault, but DOM manipulations are expensive. The more DOM you&#8217;re manipulating, the more the responsiveness is going to suffer. Remember when this was a real problem on desktops several years ago? Well, it&#8217;s the same on mobile now. It&#8217;s frustrating.</p>
<p>Here&#8217;s one place hybrid apps tend to really fall behind &#8211; interacting with core OS services. HTML5 offers new support for basic features such as address book and some media-related tasks, geo location, etc, but only to a point. As you develop enough hybrid apps, you start to get the feel for things you can and can&#8217;t do. PhoneGap has done a great job of providing a good native API and a set of helpful plugins, but it does not solve every problem. New plugin needs still require a native programming to interface with your JS. It gets a bit sticky</p>
<h2>Native Learning Curves</h2>
<p>The learning curve kept me from iOS development initially. If your only prior experience was most web technologies, it&#8217;s understandable. There is a bit of a steep learning curve if most concepts core to Objective C are new to you, but be assured it&#8217;s not impossible. It just takes work, as it does with any new language and/or framework. My experience shows that once I started picking up the generalities, the specifics started to fall into place. It gets better. Seek the help of programming books and <a href="http://www.stackoverflow.com" target="_blank">Stack Overflow</a>. Study at sample projects (Apple and Google both provide them) and understand them.</p>
<h2>Finally, Stand</h2>
<p>If you&#8217;ve read this far, congratulate yourself. I&#8217;m not normally this long-winded. Or am I? Anyhow, where do I stand? Which is better? Both. Well. Sort of. I mean, I think if you have the chops for native development and the help of a good designer and UX colleague, do it. I believe that at this point of time, you are going to get the best results from developing native apps, especially on iOS. Hybrid apps, in my opinion, are going to be the most obvious choice when clients are wanting cross-platform apps on limited budgets. I don&#8217;t mean this to imply native apps are prohibitively expensive. Rather, hybrid apps do allow you to perform a bit of a shortcut by only having to write one codebase for multiple platforms. The question of whether or not the tradeoff is worth it. Do you feel you can create as quality of an experience with hybrid apps as with native? That&#8217;s for you to answer, and then to explain to your clients. You may be of the opinion that native apps are most ideal (that&#8217;s how I feel), however sometimes the decision isn&#8217;t yours &#8211; directly or indirectly.</p>
<p>I&#8217;ll probably get some flack for this. Remember, use the right tool. Sometimes that&#8217;s determined more by budget than technology. A client looking to develop a low-cost app for iOS, Android, and Blackberry will not get quite the same experience as if the same app were developed separately for each platform. Remember &#8211; you pay for cutting corners. Some people are OK with that.</p>
<p>To answer the post&#8217;s title question? Not yet. I think there&#8217;s still plenty of catching up to do, however I don&#8217;t have many hopes for full OS-level integration for web technologies (remember, the web is platform-agnostic).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/273/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=273&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2011/10/10/will-hybrid-mobile-apps-prevail-over-native/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>GeoLocation Near You</title>
		<link>http://iamcam.wordpress.com/2011/08/31/geolocation-near-you/</link>
		<comments>http://iamcam.wordpress.com/2011/08/31/geolocation-near-you/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 17:22:02 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=256</guid>
		<description><![CDATA[We at Pivotal Action were recently given a task for a client &#8211; develop a tool for a mobile API where admin can upload a list of retailers so that their mobile app users could find locations near them. It&#8217;s basically a &#8220;Find near me&#8221; utility. This type of project is broken down into 3 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=256&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>We at <a href="http://www.PivotalAction.com">Pivotal Action</a> were recently given a task for a client &#8211; develop a tool for a mobile API where admin can upload a list of retailers so that their mobile app users could find locations near them. It&#8217;s basically a &#8220;Find near me&#8221; utility.</p>
<p>This type of project is broken down into 3 parts: Upload &amp; store geolocation data, find addresses near a given point, and display those locations either textually or on a map display. This quick tutorial will cover the first two parts.</p>
<h3>Part 1, Getting Located</h3>
<p>The goal of this part is to obtain and store latitude/longitude pairs for given addresses. I&#8217;m going to assume you can already get a list of addresses, whether for a spreadsheet/csv file, or other source. With a parsed address, you can obtain the lat/lng pairs from the Google Maps API. Just be forewarned that Google limits you to 2,500 requests per 24h period. That could be a problem for some applications, so you may need another provider like <a href="http://www.SimpleGeo.com" target="_blank">SimpleGeo.com</a></p>
<pre>&lt;?php
// Google maps API. rate limit to 2,500 reqs/24h
$url 		= 'http://maps.googleapis.com/maps/api/geocode/json';
$address	= urlencode($row['address']);
$city		= urlencode($row['city']);
$state		= urlencode($row['state']);
$zip 		=  $row['zip'];

$requestUrl = $url."?address=".($address.",".$city.",".$state.",".$zip). "&amp;sensor=false";
// echo $requestUrl;

$crl = curl_init();
curl_setopt($crl, CURLOPT_HEADER, 0);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1); 

// Set up the CURL request
curl_setopt($crl, CURLOPT_URL, $requestUrl); 

// Here we get the google result in JSON
$googJson = curl_exec($crl);

curl_close($crl);

$googArr = json_decode($googJson);
$status = $googArr-&gt;status;
$loc = $googArr-&gt;results[0]-&gt;geometry-&gt;location;
if( strtolower($status) == "ok" ){
	$tableData[count($tableData) - 1]['lat'] = $loc-&gt;lat;
	$tableData[count($tableData) - 1]['lng'] = $loc-&gt;lng;
} else {
	$tableData[count($tableData) - 1]['lat'] = 0.0;
	$tableData[count($tableData) - 1]['lng'] = 0.0;
}

//go on to save $tableData to your DB

?&gt;</pre>
<p>There are a couple key parts in there. First, you need to URL encode the address details. Second, the curl stuff is pretty standard &#8211; you can find similar versions all over the net. Third, the response data comes back as a JSON string, so you need to decode it into a PHP array to make it useful. My default value for lat/lng pairs is 0.0/0.0. There may be cases where Google doesn&#8217;t understand the address information or perhaps you&#8217;ve gone over your rate limit, so you have to accept more or less a throw-away response. The important thing is that you have your address coordinates saved (dare I say, cached) in your DB. You need this.</p>
<h3>Part 2, Finding Yourself</h3>
<p>Now how are you supposed to find these stores that are near you, at this moment, without having to use a lame web form or other manual means? You&#8217;re going to use the <a href="http://en.wikipedia.org/wiki/Haversine_formula" target="_blank">Haversine</a>, aka Great Circle  Formula. Don&#8217;t click that link unless you really want to be confused. Here&#8217;s the gist &#8211; the globe is a big sphere, and we know from high school and/or college trigonometry classes that you can figure out lengths and distances on geometric objects. Some guy long ago (whose name was not Haversine) sat down and figured this out for us. What we get as a result of running these maths is the distance between to points on earth, using lat/long pairs. The caveat is these are as the crow flies, not driving directions. What I&#8217;m going to show you below is some SQL you can use to find the <em>N</em> closest points within a given distance. This will work on MySQL, and I&#8217;m assuming other SQL-compliant DBs. YMMV.</p>
<pre>// scale:  MILES - use 3959 ;  KM - use 6371 (mean radius of the earth)
$scale = 3959;
$sql = "SELECT name, address, city, state, zip,  ( "
. (int) $scale ." * acos( cos( radians(".(float) $loc['lat']
. ") ) * cos( radians( lat ) ) * cos( radians( lng ) - radians("
. (float) $loc['lng'].") ) + sin( radians(". (float) $loc['lat']
. ") ) * sin( radians( lat ) ) ) ) AS distance FROM "
. $tablename ." HAVING distance &lt; ". (int) $distance 
. " ORDER BY distance LIMIT 0 , ". (int) $limit . ";";</pre>
<p>(Thank Pavel Chuchuva on Stack Overflow for the SQL [<a href="http://stackoverflow.com/questions/574691/mysql-great-circle-distance-haversine-formula/574736#574736" target="_blank">answer here</a>]). You only need a couple parameters to get this chugging along and giving you a list of distances, closest to farthest from the point you are feeding it. Along with your address information, you&#8217;re also provided a distance in miles (using 3959 for measurement in Km).</p>
<p>Now you can use these results to display distances to your users. Let Google be your guide for implementing Part 3.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/256/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=256&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2011/08/31/geolocation-near-you/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>Quiet NSLog() in Release Builds</title>
		<link>http://iamcam.wordpress.com/2011/07/31/quiet-nslog-in-release-builds/</link>
		<comments>http://iamcam.wordpress.com/2011/07/31/quiet-nslog-in-release-builds/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 17:13:06 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=254</guid>
		<description><![CDATA[On the heels of the previous post, here&#8217;s a little snippit I picked up from Marek Bell to quiet NSLog() output in release builds. Add this to your {MyApp}-prefix.pch file #ifndef __OPTIMIZE__ #    define NSLog(&#8230;) NSLog(__VA_ARGS__) #else #    define NSLog(&#8230;) {} #endif The reasoning behind using __OPTIMIZE__ is that it&#8217;s set only on release builds [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=254&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>On the heels of the previous post, here&#8217;s a little snippit I picked up from <a href="http://www.marekbell.com/Marek_Bell/Blog/Entries/2009/3/25_Removing_NSLogs_on_Release_Builds.html" target="_blank">Marek Bell</a> to quiet NSLog() output in release builds.</p>
<p>Add this to your {MyApp}-prefix.pch file</p>
<p>#ifndef __OPTIMIZE__<br />
#    define NSLog(&#8230;) NSLog(__VA_ARGS__)<br />
#else<br />
#    define NSLog(&#8230;) {}<br />
#endif</p>
<p>The reasoning behind using __OPTIMIZE__ is that it&#8217;s set only on release builds of your app, not in debug versions. It&#8217;s very simple and allows you to use NSLog() instead of having to come up with your own version.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/254/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=254&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2011/07/31/quiet-nslog-in-release-builds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>Quiet the Console &#8211; PhoneGap / iOS</title>
		<link>http://iamcam.wordpress.com/2011/07/26/quiet-the-console-phonegap-ios/</link>
		<comments>http://iamcam.wordpress.com/2011/07/26/quiet-the-console-phonegap-ios/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 23:36:08 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=249</guid>
		<description><![CDATA[I have a confession &#8211; I&#8217;m a console logging junkie. I just like to see what&#8217;s going on. While that may be great for development, at some point you&#8217;ll have to quiet the logging down for production. Really &#8211; doing enough logging will slow everything down each time you&#8217;ve inserted a console.log() into your code. [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=249&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I have a confession &#8211; I&#8217;m a console logging junkie. I just like to see what&#8217;s going on. While that may be great for development, at some point you&#8217;ll have to quiet the logging down for production. Really &#8211; doing enough logging will slow everything down each time you&#8217;ve inserted a console.log() into your code.</p>
<p>Silencing the output to XCode&#8217;s debugging console wasn&#8217;t immediately obvious. Overriding console.log() in JS by setting it to an empty function worked in the browser for development, but as soon as I loaded the app onto the actual simulator, we were back to square one. Enter the PhoneGap DebugConsole prototype. Override it.</p>
<p>Insert this anywhere after your phonegap.js file loads. It&#8217;ll keep things quiet as long as DEBUG = true&#8230;</p>
<pre>if(DEBUG == true){
    DebugConsole.prototype.log = function(message, maxDepth) { }
    DebugConsole.prototype.warn = function(message, maxDepth) { }
    window.console = new DebugConsole();
}</pre>
<p>There you have it</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/249/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=249&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2011/07/26/quiet-the-console-phonegap-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
		<item>
		<title>PhoneGap + XCode4</title>
		<link>http://iamcam.wordpress.com/2011/03/17/phonegap-xcode4/</link>
		<comments>http://iamcam.wordpress.com/2011/03/17/phonegap-xcode4/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 01:04:48 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[XCode4]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=233</guid>
		<description><![CDATA[There&#8217;s been a bit of confusion surrounding changes to XCode4 and PhoneGap. Right now the big ones are 1) Where did my PhoneGap user templates go!? and 2) How do I submit my PhoneGap-based app to Apple? Let me help you. 1) You want to create a new PG project, but you&#8217;re not seeing the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=233&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>There&#8217;s been a bit of confusion surrounding changes to XCode4 and PhoneGap. Right now the big ones are 1) Where did my PhoneGap user templates go!? and 2) How do I submit my PhoneGap-based app to Apple? Let me help you.</p>
<p>1) You want to create a new PG project, but you&#8217;re not seeing the XCode templates when you go through the new project menus. Check out <a title="Sazron's XCode4 + PhoneGap template fix" href="http://blogs.nitobi.com/shazron/2011/03/16/creating-a-phonegap-project-from-the-command-line-for-xcode-4/">Shazron&#8217;s blog</a> @ Nitobi for a command-line script to get you a new project up and running. It&#8217;s not as sexy as the XCode template, but it will do.</p>
<p>2) You can&#8217;t compile your app for submission to Apple? That was a little more tricky to track down. See <a href="https://devforums.apple.com/message/375793#375793">this thread</a> on the Apple Dev Forums for a bit of an abstract view of what&#8217;s going on. I&#8217;ll save you the details. Follow these steps to XCode bliss.</p>
<ol>
<li>Select the PhoneGapLib.xcodeproj entry in your files list:<img class="alignnone size-full wp-image-238" title="00000050" src="http://iamcam.files.wordpress.com/2011/03/00000050.png?w=580" alt=""   /></li>
<li>Make sure the &#8220;All&#8221; tab is selected:<br />
<a href="http://iamcam.files.wordpress.com/2011/03/00000051.png"><img class="alignnone size-full wp-image-240" title="00000051" src="http://iamcam.files.wordpress.com/2011/03/00000051.png?w=580" alt=""   /></a></li>
<li>Look for the &#8220;Deployment&#8221; section and scroll down until you see the &#8220;Skip Install&#8221; parameter. Set Skip Install to YES:<br />
<a href="http://iamcam.files.wordpress.com/2011/03/00000052.png"><img class="alignnone size-full wp-image-241" title="00000052" src="http://iamcam.files.wordpress.com/2011/03/00000052.png?w=580" alt=""   /></a></li>
<li><strong>EDIT: Make sure to verify your target device&#8230;</strong><br />
Make sure you have the &#8220;iOS Device&#8221; option selected in the schemes drop-down:<br />
<a href="http://iamcam.files.wordpress.com/2011/03/select-device.png"><img class="alignnone size-full wp-image-243" title="select-device" src="http://iamcam.files.wordpress.com/2011/03/select-device.png?w=580" alt=""   /></a></li>
<li> Go over to the &#8220;Product &gt; Archive&#8221; menu. XCode will do its compile magic. Open the Organizer to see the app and the listed archives when the compile is complete. At this point, make sure you are ready to upload the app to iTunes Connect. Bonus: we get to skip the Application Loader app from now on!</li>
<li>Select the archive and click the &#8220;Submit&#8221; button. XCode will ask for your credentials. Log in and select the appropriate app and distribution profile from the list. Submit. If all goes to plan, you&#8217;ll get a message of approval. Finished.</li>
</ol>
<p>That was easy. Now you can navigate the XCode4 waters with PhoneGap.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/233/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=233&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2011/03/17/phonegap-xcode4/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>

		<media:content url="http://iamcam.files.wordpress.com/2011/03/00000050.png" medium="image">
			<media:title type="html">00000050</media:title>
		</media:content>

		<media:content url="http://iamcam.files.wordpress.com/2011/03/00000051.png" medium="image">
			<media:title type="html">00000051</media:title>
		</media:content>

		<media:content url="http://iamcam.files.wordpress.com/2011/03/00000052.png" medium="image">
			<media:title type="html">00000052</media:title>
		</media:content>

		<media:content url="http://iamcam.files.wordpress.com/2011/03/select-device.png" medium="image">
			<media:title type="html">select-device</media:title>
		</media:content>
	</item>
		<item>
		<title>Catching Android&#8217;s Back Button in PhoneGap</title>
		<link>http://iamcam.wordpress.com/2011/03/03/catching-androids-back-button-in-phonegap/</link>
		<comments>http://iamcam.wordpress.com/2011/03/03/catching-androids-back-button-in-phonegap/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 07:48:04 +0000</pubDate>
		<dc:creator>Cameron Perry</dc:creator>
				<category><![CDATA[Design and Usability]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[Sencha Touch]]></category>

		<guid isPermaLink="false">http://iamcam.wordpress.com/?p=229</guid>
		<description><![CDATA[This little bit of code is going to be useful to those of you developing a &#8220;singe page&#8221; app inside of PhoneGap. This applies to Sencha Touch (big fan), but doesn&#8217;t as much to jQuery mobile and jQTouch, as it&#8217;s a multi-page/navigation based event framework (it uses the app&#8217;s url string to do things like [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=229&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This little bit of code is going to be useful to those of you developing a &#8220;singe page&#8221; app inside of PhoneGap. This applies to <a href="http://www.sencha.com/products/touch">Sencha Touch</a> (big fan), but doesn&#8217;t as much to <a href="http://jquerymobile.com/">jQuery mobile</a> and <a href="http://www.jqtouch.com/">jQTouch</a>, as it&#8217;s a multi-page/navigation based event framework (it uses the app&#8217;s url string to do things like move around to different link anchors). This is really important on these single page apps because the Android hardware back button will send the PhoneGap app to the background. You need some way to intercept it so you can start building your own history management mechanism. Sounds fun, right? It&#8217;s actually not that hard.</p>
<p>On app initialization, add an event listener for Android&#8217;s back button, and the callback to handle it. PhoneGap takes care of the interface between Android and your app.</p>
<pre>document.addEventListener("backbutton", backKeyDown, true); 
function backKeyDown() { 
     // Call my back key code here.
 	alert('go back!');
}</pre>
<p>That&#8217;s enough to get you started, and it should be pretty apparent if it works or not.</p>
<p>How about history management? It will depend on the app and what makes sense, BUT you&#8217;ll probably want to create a history array, and pop off some value that directs the app each time you hit the hardware back button. Here&#8217;s another idea: change the destination of the back button depending on the view. I personally like the idea of the latter because apps built on Sencha Touch are going to have easy tie-ins through predefined listeners JS Objects that define screen elements like buttons.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamcam.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamcam.wordpress.com/229/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamcam.wordpress.com&#038;blog=40512&#038;post=229&#038;subd=iamcam&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://iamcam.wordpress.com/2011/03/03/catching-androids-back-button-in-phonegap/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/9f70334a8d2b026223f965453e714da3?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">iamcam</media:title>
		</media:content>
	</item>
	</channel>
</rss>
