<?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>MobileSnapp</title>
	<atom:link href="http://blog.mobilesnapp.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mobilesnapp.com</link>
	<description>App in a Snapp</description>
	<lastBuildDate>Thu, 06 Oct 2011 17:49:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Remembering Steve Jobs</title>
		<link>http://blog.mobilesnapp.com/2011/10/remembering-steve-jobs/</link>
		<comments>http://blog.mobilesnapp.com/2011/10/remembering-steve-jobs/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 17:49:12 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Entrepreneur Bites]]></category>
		<category><![CDATA[Main]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=441</guid>
		<description><![CDATA[Steven Paul Jobs, 56, died Wednesday at his home with his family. The co-founder and, until last August, CEO of Apple Inc was the most celebrated person in technology and business on the planet. No one will take issue with the official Apple statement that “The world is immeasurably better because of Steve.” With Steve [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/a-tribute-to-steve-jobs-we-all-are-steve-jobs.jpg"><img class="aligncenter size-full wp-image-492" title="a-tribute-to-steve-jobs-we-all-are-steve-jobs" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/a-tribute-to-steve-jobs-we-all-are-steve-jobs.jpg" alt="" width="400" height="302" /></a></p>
<p>Steven Paul Jobs, 56, died Wednesday at his home with his family. The co-founder and, until last August, CEO of Apple Inc was the most celebrated person in technology and business on the planet. No one will take issue with the official Apple statement that “The world is immeasurably better because of Steve.”</p>
<p>With Steve Jobs&#8217; passing, we have lost one of the greatest technological innovators of our time.</p>
<p>Jobs wasn&#8217;t just a savvy businessman, he was a visionary who made it his mission to humanize personal computing, rewriting the rules of user experience design, hardware design and software design. His actions reverberated across industry lines: He shook up the music business, dragged the wireless carriers into the boxing ring, changed the way software and hardware are sold and forever altered the language of computer interfaces. Along the way, he built Apple up into one of the most valuable corporations in the world.</p>
<h3>Apple I, 1976</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_one_f.jpg"><img class="aligncenter size-full wp-image-446" title="apple_one_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_one_f.jpg" alt="" width="370" height="304" /></a></p>
<p>Apple Computer was founded on April 1, 1976 by a small group headed by Jobs, engineer Steve Wozniak and industry vet Ronald Wayne, who was brought in to provide &#8220;adult supervision.&#8221;</p>
<p>Priced at $666.66, Apple&#8217;s first computer was little more than a circuit board. Once you bought one, you still had to hook up your own keyboard, monitor and power supply. As such, the Apple appealed mostly to the DIY hardware hackers of the day, who had these things on hand already.</p>
<h3>Apple II, 1977</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_II_01.jpg"><img class="aligncenter size-full wp-image-450" title="apple_II_01" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_II_01.jpg" alt="" width="396" height="260" /></a></p>
<p>The company hit the jackpot one year later with 1977&#8242;s Apple II, a fully assembled desktop computer in a handsome case. Hackers still took to it because of its expandability. More importantly, schools used it to teach programming (it ran Integer BASIC) and offices started snatching them up once VisiCalc launched on the nascent platform.</p>
<h3>Macintosh, 1984</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_macintosh_02.jpg"><img class="aligncenter size-full wp-image-452" title="apple_macintosh_02" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_macintosh_02.jpg" alt="" width="396" height="271" /></a></p>
<p>The Macintosh arrived in 1984, and it was the first computer to successfully integrate two things that are now commonplace: a graphical user interface and a mouse. Little pictures of folders, the piece of paper denoting a file, the trash can — most of us learned how all of these things worked when we sat down at the Mac. Drag-and-drop, too.</p>
<p>Apple launched the Macintosh with a massive media campaign spearheaded by a minute-long TV commercial (riffing on Orwell&#8217;s <em>1984</em>) that aired during the Super Bowl.</p>
<p><a href="http://www.youtube.com/watch?feature=player_embedded&amp;v=OYecfV3ubP8">Apple&#8217;s Super Bowl Ad</a></p>
<h3>Apple IIc, 1984</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_iic_f.jpg"><img class="aligncenter size-full wp-image-457" title="apple_iic_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_iic_f.jpg" alt="" width="396" height="237" /></a></p>
<p>Only a few months after launching the Macintosh, Apple released the Apple IIc, a slimmed-down version of the Apple II that was much more portable. It had a handle on the back so you could carry it around comfortably with one hand. It wasn&#8217;t quite a laptop — the monitor and power supply weren&#8217;t attached — and the guts weren&#8217;t a whole lot different than what you got in the bigger Apple II models. But the little white eight-pound box was an important step for desktop computers.</p>
<p>It was one of the first small-form-factor PCs to hit the market, signaling the industry-wide move toward compact, integrated designs that would come later. Also, its diminutive size and unassuming looks were far less intimidating than the hulking machines common in the mid-1980s. It was an era when computers beginning to creep into middle-class homes, and first-time buyers found the IIc a &#8220;friendly&#8221; and appealing option. It looked equally attractive in the family room as it did in the office.</p>
<h3>LaserWriter, 1985</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/laserwriter_f.jpg"><img class="aligncenter size-full wp-image-460" title="laserwriter_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/laserwriter_f.jpg" alt="" width="396" height="287" /></a></p>
<p>It cost $7,000 and was bigger than your microwave. But put one on your desk and you could publish your own newspaper.</p>
<p>The LaserWriter wasn&#8217;t the first desktop laser printer to hit the market, but it was the first created for the Macintosh, and the first to use the cutting-edge PostScript language that gave designers a new level of control over page layout, text options, and graphics. It was announced on the same day as its killer app, Aldus PageMaker.</p>
<p>So while the LaserWriter wasn&#8217;t the first shot fired in the desktop publishing revolution, it was the first to draw blood.</p>
<h3>Pixar, 1986</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/jobs_pixar_f.jpg"><img class="aligncenter size-full wp-image-463" title="jobs_pixar_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/jobs_pixar_f.jpg" alt="" width="396" height="304" /></a></p>
<p>Steve Jobs bought Pixar in 1986. At the time, it was a small group of engineers spun off from the computer graphics department at Lucasfilm. Jobs paid $5 million to George Lucas and sank $5 million of his own money into the company.</p>
<p>His original vision for Pixar was to develop graphics-rendering hardware and software, but the business eventually evolved into an animation studio. Jobs signed a distribution deal with Disney and Pixar began cranking out a string of hit family films, all of them computer-animated. 1995&#8242;s <em>Toy Story</em> was the first blockbuster. <em>Toy Story 2</em>, <em>Monsters, Inc.</em>, <em>Finding Nemo</em>, <em>The Incredibles</em>, <em>Cars</em>, <em>WALL-E</em> and <em>Up</em>followed. Accolades and Oscars came rolling in, along with massive mountains of cash.</p>
<p>In 2006, Jobs flipped his original $10 million investment, selling Pixar to Disney for $7.4 billion in stock. That&#8217;s one hell of an exit.</p>
<h3>NeXT, 1988</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/next_computer_f.jpg"><img class="aligncenter size-full wp-image-466" title="next_computer_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/next_computer_f.jpg" alt="" width="396" height="175" /></a></p>
<p>After the success of the Macintosh, Jobs was marginalized by Apple&#8217;s board of directors, so he left to found a new computer company called NeXT. Without Jobs at the helm, Apple floundered through the early 1990s. A series of missteps eventually caused the company&#8217;s market share to fall into the low single digits.</p>
<p>Meanwhile, Jobs launched a new computer system at NeXT. Its most famous workstation was an austere black cube — Jobs constantly pushed his designers to experiment with innovative case constructions throughout his career — that cost $6,500. It ran a new operating system, NeXTSTEP, which was based on Unix.</p>
<p>Though it was pricey, it was fast and especially adept at math functions, and it had a built-in Ethernet port in an age when most computers still needed a network interface card. Because of these high-end features, NeXT boxes were ignored by the mass market, but quickly snatched up by academics and programmers. Tim Berners-Lee used one to write the first web server and the first web browser. The first server node on the World Wide Web was a NeXT box.</p>
<h3>iMac, 1998</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_imac_03.jpg"><img class="aligncenter size-full wp-image-468" title="apple_imac_03" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_imac_03.jpg" alt="" width="396" height="275" /></a></p>
<p>After NeXT failed to gain traction, Jobs sold the company to Apple and came back into the fold in 1996. Two years later, the company released a complete rewrite of the desktop PC — the candy-colored iMac. It kicked the boring beige PC box to the curb, and it marked the return of the revolutionary all-in-one design first introduced by the original Macintosh. The first iMac was a runaway hit, and the all-in-one design is still used by today&#8217;s iMac (and widely copied by other PC manufacturers).</p>
<h3>Power Mac G4 Cube, 2000</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_g4_f.jpg"><img class="aligncenter size-full wp-image-470" title="apple_g4_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_g4_f.jpg" alt="" width="396" height="297" /></a></p>
<p>Jobs wasn&#8217;t ready to let go of his dream of a cube-shaped computer, which he first tried at NeXT. He encouraged Apple designer Jonathan Ive to work the shape into the Power Mac line, and the company pumped out the eight-inch clear acrylic cube in 2000.</p>
<p>It didn&#8217;t do so hot. It was $1,800, the disk drive had problems, and the case developed stress cracks easily.</p>
<p>Still, it was a forward-thinking step that design nerds still drool over. There&#8217;s even one in the MoMA&#8217;s permanent collection.</p>
<h3>iPod, 2001</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_ipod_04.jpg"><img class="aligncenter size-full wp-image-472" title="apple_ipod_04" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_ipod_04.jpg" alt="" width="396" height="458" /></a></p>
<p>The first iPod was a $400 MP3 player with a 5-gigabyte hard drive and a mechanical scroll wheel that didn&#8217;t sync to Windows machines. Not a very likely candidate for the device that would completely change the music industry.</p>
<p>But it did, pouring fuel on the fire of online mayhem lit by Napster and creating a mindset among music device buyers where ease-of-use, convenience and sex appeal trump all other features.</p>
<p>The iPod&#8217;s all-white design was minimalist compared to other players that came before and, more importantly, the user interface was remarkably easy for anyone who picked it up to figure out.</p>
<p>The hardware had its quirks — if you got sand in the scroll wheel, you&#8217;d get stuck listening to Spin Doctors all day — but it was quickly refined to incorporate further innovations: the touch-wheel, a color screen for watching videos and eventually, the industry-standard touchscreen.</p>
<h3>Mac OS X, 2001</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_osx_05.jpg"><img class="aligncenter size-full wp-image-474" title="apple_osx_05" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_osx_05.jpg" alt="" width="396" height="297" /></a></p>
<p>When Steve Jobs returned to Apple, he ordered a rethink of the Mac&#8217;s native operating system. Of course, he pushed for NeXTSTEP — the Unix-based OS he developed independently and sold to Apple in 1996 — to serve as the blueprint.</p>
<p>Eventually surfacing in 2001, Mac OS X was a complete departure from earlier Mac operating systems and, as Jobs had promised, a true &#8220;next generation&#8221; OS.</p>
<p>It appealed to novices fluent in Windows (enabling the craze of &#8220;switching&#8221;) but it retained enough of its Unix guts and enough of Apple&#8217;s well-established interface conventions to keep the Apple geeks interested.</p>
<h3>Apple Stores, 2001</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_store_f.jpg"><img class="aligncenter size-full wp-image-476" title="apple_store_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_store_f.jpg" alt="" width="396" height="246" /></a></p>
<p>Walk into any big-box store — BestBuy, Wal-Mart, Target — and go to the computer department in the back. Look at all the PCs on display. It&#8217;s a mess of machinery, heaps of humming boxes all shaped, priced and configured differently. The sales people aren&#8217;t always well-trained, and concise technical answers are difficult to come by. Jobs understood purchasing decisions are made on the sales floor, and he didn&#8217;t want Apple&#8217;s appeal to get lost in the quagmire of somebody else&#8217;s retail failure. His solution? Build your own house.</p>
<p><a href="http://www.apple.com/retail/" target="_blank">Apple retail stores</a> began popping up in 2001. Everything about their environment is tightly controlled. Only Apple computers are displayed and accessories are thoughtfully curated. Employees are approachable and well-trained, and they carry hand-held point-of-sales devices. Every store has a Genius Bar, the retail-level customer support help desk, and most have a classroom where you can learn how to use your Mac.</p>
<p>There are now over 300 Apple Stores worldwide. Even more phenomenal than the boost they provide to Apple sales is the way they fuel the Apple culture. On regular days, the stores buzz with the excitement of a crowded nightclub. On product launch days, eager customers queue up for hours, even days.</p>
<h3>iTunes Store, 2003</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_itunes_06.jpg"><img class="aligncenter size-full wp-image-478" title="apple_itunes_06" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_itunes_06.jpg" alt="" width="396" height="311" /></a></p>
<p>iTunes was the first hint at Jobs&#8217; vision to turn the home PC into a &#8220;digital lifestyle hub.&#8221; That plan was cemented in 2003 by the debut of the iTunes Store. Suddenly, it wasn&#8217;t just about creating or collecting media, but purchasing it, too.</p>
<p>And because it was directly plugged into the iPods everyone already owned, the iTunes Store was a huge hit. With it came the era of the digital single, easily downloadable for $0.99 and offering instant satisfaction.</p>
<p>Of course, the record companies weren&#8217;t happy to see their monopoly on distribution challenged. But traditional retail tapered while iTunes exploded. Tower Records folded. Virgin Megastores were boarded up. By 2007, Apple was selling 5 million songs a day.</p>
<h3>Intel MacBook Pro, 2006</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/intel_macbook_f.jpg"><img class="aligncenter size-full wp-image-480" title="intel_macbook_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/intel_macbook_f.jpg" alt="" width="396" height="256" /></a></p>
<p>In 2006, Jobs announced that Apple would be switching from PowerPC processors to Intel&#8217;s Core Duo chips. The MacBook Pro, released soon after the announcement, was Apple&#8217;s first laptop with an Intel CPU. The whole Apple line was transitioned to Intel before the end of the year, an astonishingly short period of time.</p>
<p>Jobs said he and the Apple engineers felt the PowerPC architecture had hit a ceiling and wasn&#8217;t improving fast enough. By switching to Intel, the average clock speeds of Macs were drastically improved, especially in laptops. Sales soared, too, as Apple laptops could finally compete on both price and performance with Windows-based machines (and they could even <em>run</em> Windows).</p>
<h3>iPhone, 2007</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_iphone_07.jpg"><img class="aligncenter size-full wp-image-482" title="apple_iphone_07" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_iphone_07.jpg" alt="" width="396" height="264" /></a></p>
<p>During his keynote address at Macworld 2007, Jobs said Apple would announce three things: &#8220;A widescreen iPod with touch controls, a revolutionary mobile phone and a breakthrough internet communications device. An iPod, a phone and an internet communicator.&#8221; Of course, it was all three of those things in one — the iPhone.</p>
<p>Years on, Apple&#8217;s phone has not only completely changed our expectations of how a smartphone should look, feel and behave, but Jobs&#8217; famous wrangling with the wireless carriers has toppled the long-standing power structure in the industry.</p>
<p>Before Apple, carriers insisted on controlling the hardware and software on their phones. Now, if they want the hottest phones, the carriers have to play ball.</p>
<h3>App Store, iPhone SDK, 2008</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_sdk_08.jpg"><img class="aligncenter size-full wp-image-484" title="apple_sdk_08" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_sdk_08.jpg" alt="" width="378" height="252" /></a></p>
<p>The next time you&#8217;re in an Apple Store, take a look at that constantly shrinking shelf of boxed software. Smells like 2007, right?</p>
<p>With the arrival of the iPhone SDK in 2008, developers could create their own native apps for the iPhone and sell them through the App Store built into iTunes. This not only set up a clean, centralized distribution model for apps, but also introduced a budget-minded pricing structure — $1 and $2 apps — that encouraged you to download as many apps as you wanted. It was a boon for developers.</p>
<p>Unfortunately, it also earned Apple the title of &#8220;Gatekeeper,&#8221; souring relationships with developers who were suddenly subjected to the company&#8217;s arcane app approval guidelines.</p>
<p>But the damage is done. Today, it&#8217;s all about apps.</p>
<h3>MacBook Air, 2008</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/macbook_air_f.jpg"><img class="aligncenter size-full wp-image-486" title="macbook_air_f" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/macbook_air_f.jpg" alt="" width="396" height="262" /></a></p>
<p>When it showed up in 2008, the <a href="http://www.apple.com/macbookair/" target="_blank">MacBook Air</a> was touted as &#8220;the world&#8217;s thinnest notebook.&#8221;</p>
<p>Thin and light have always been sexy, but this one was weird. It shipped without an optical drive. You could buy an external DVD drive if you really needed one, or you could simply &#8220;borrow&#8221; another computer&#8217;s DVD drive and beam the data over Wi-Fi. Even though many laughed at the notion, the Air was Exhibit A to those predicting the death of the optical drive.</p>
<p>Close to four years later, disks and drives are still around, but they are disappearing quickly as software increasingly moves into the browser and into cloud-based app stores.</p>
<p>Also, Windows laptop manufacturers are now competing in an entirely new category: &#8220;ultrabooks.&#8221; These super-portable laptops cost a little more, but they are thin, very light, use SSDs, ship without optical drives and are fitted into brushed metal cases — just like the MacBook Air.</p>
<h3>iPad, 2010</h3>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_ipad_09.jpg"><img class="aligncenter size-full wp-image-488" title="apple_ipad_09" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/10/apple_ipad_09.jpg" alt="" width="408" height="304" /></a></p>
<p>It&#8217;s the device everyone wanted Apple to create, even though most of us weren&#8217;t sure how it was going to fit into our lives once it got here. But Jobs got sentimental when showing off the first iPad in 2010. He said it was a culmination of years of work, starting with OS X, then iTunes, then the iPhone, then the App Store.</p>
<p>The shockwaves are still evident more than a year later as manufacturers race to catch up, pumping out their own tablets. But they can&#8217;t match Apple&#8217;s success.</p>
<p>The iPad 2 was Steve&#8217;s swan song. We all felt it, but few chose to accept it. What nobody can argue is that the man went out on top, crossing the finish line well ahead of everyone else.</p>
<div>
<p>Quite a run. Steve Jobs, you will be missed.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/10/remembering-steve-jobs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to implement Push Notifications: Apple iOS</title>
		<link>http://blog.mobilesnapp.com/2011/07/how-to-implement-push-notifications-apple-ios/</link>
		<comments>http://blog.mobilesnapp.com/2011/07/how-to-implement-push-notifications-apple-ios/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 22:16:37 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tech Tuesdays]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=401</guid>
		<description><![CDATA[Local notifications and push notifications are both ways for an application that isn’t running in the foreground to let its users know it has something for them. That something could be a message, an impending calendar event, or new data on a remote server. When presented by the operating system, local and push notifications look [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/push-notification-service.png"><img class="size-full wp-image-419 aligncenter" title="push-notification-service" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/push-notification-service.png" alt="" width="200" height="150" /></a></p>
<p>Local notifications and push notifications are both ways for an application that isn’t running in the foreground to let its users know it has something for them. That something could be a message, an impending calendar event, or new data on a remote server. When presented by the operating system, local and push notifications look and sound the same. They can display an alert message or badge the application icon. They can also play a sound when the alert or badge number is shown.</p>
<p><em> Push notifications were introduced in iOS 3.0, and local notifications in iOS 4.0. Push notifications and local notifications are not related to broadcast notifications (<a href="http://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/Reference/Reference.html#//apple_ref/occ/cl/NSNotificationCenter" target="_self">NSNotificationCenter</a>) or key-value observing notifications.</em></p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/local_notification.jpg"><img class="aligncenter size-full wp-image-409" title="local_notification" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/local_notification.jpg" alt="" width="262" height="386" /></a></p>
<p>Once users are aware that the application has a message, event, or other data for them, they can launch the application and access that item. They can also choose to ignore the notification, in which case the application is not activated.</p>
<div>
<p>Apple provides <a href="http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html"><strong>detailed code documentation for the iPhone OS code</strong></a> that is needed to implement and handle the alerts on the device but only provides a higher level guide for the provider server side.</p>
<p>As a provider, you need to communicate with the APNS to send the messages that are then pushed to the phone. This is necessary so that the device only needs to maintain 1 connection to the APNS, helping to reduce battery usage.</p>
<p>This tutorial will go into code-level detail about how we built our push notification provider server to allow us to interact with the APNS and use the push notifications with our server monitoring iPhone application. Since we develop in PHP, our examples will be in PHP 5.</p>
<p><strong>Basic Structure</strong></p>
<ol>
<li>You connect to the APNS using your unique SSL certificate</li>
<li>Cycle through the messages you want to send (or just send 1 if you only have 1)</li>
<li>Construct the payload for each message</li>
<li>Disconnect from APNS</li>
</ol>
<p><em>The flow of remote-notification data is one-way. The provider composes a notification package that includes the device token for a client application and the payload. The provider sends the notification to APNS which in turn pushes the notification to the device.</em></p>
<p>- <a href="http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html"><strong>Apple documentation</strong></a></p>
<p>The APNS allows applications to notify their users of remote events. If the user has turned on Notifications from the Settings application, her device will maintain a persistent IP connection to the APNS. Only one connection is maintained and all third-party notifications are forwarded (by providers) through Apple’s own servers.</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/post-9-127491891366_thumb.png"><img class="aligncenter size-full wp-image-412" title="post-9-127491891366_thumb" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/post-9-127491891366_thumb.png" alt="" width="432" height="71" /></a></p>
</div>
<p>When a device receives a notification for an application and that application isn’t running, it notifies the user through an alert message or a sound, or by adding a numbered badge to the application. The APNS does not provide any feedback as to whether the message was successfully delivered to the user.</p>
<p><strong>Restrictions</strong></p>
<ul>
<li>The payload is limited to 256 bytes in total – this includes both the actual body message and all of the optional and additional attributes you might wish to send. Push notifications are not designed for large data transfer, only for small alerts. For example we only send a short alert message detailing the server monitoring alert triggered.</li>
<li>APNS does not provide any status feedback as to whether your message was successfully delivered. One reason for this is that messages are queued to be sent to the device if it is unreachable, however only the last sent message will be queued – overwriting any previously sent but undelivered messages.</li>
<li>Push notifications should not be used for critical alerts because the message will only be delivered if the device has wifi or cellular connectivity, which is why we recommend combining push with another alerting method such as e-mail or SMS for our server monitoring alerts.</li>
<li>The SSL certificates used to communicate with APNS, discussed below, are generated on an application level. The implementation discussed in this tutorial only concerns a single iPhone application so if you have several, you will need to adapt the code to use the appropriate certificate(s) where necessary.</li>
</ul>
<p><strong>Device Token</strong></p>
<p>Each push message must be “addressed” to a specific device. This is achieved by using a unique deviceToken generated by APNS within your iPhone application. Once this token has been retrieved, you need to store it on your server, not within your iPhone application itself. It looks something like this:</p>
<p>c9d4c07c fbbc26d6 ef87a44d 53e16983 1096a5d5 fd825475 56659ddd f715defc</p>
<p>For iPhone applications, we call the necessary generation methods on app launch and pass it back to our servers via an HTTP API call. This stores the deviceToken in a database on our servers for that user so we can then communicate with the device linked to that user</p>
<p><strong>Feedback Service</strong></p>
<p>Apple provides a <a href="http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3"><strong>feedback service</strong></a> which you are supposed to occasionally poll. This will provide a list of deviceTokens that were previously, but are no longer, valid, like if the user has uninstalled your iPhone application. You can then remove the deviceToken from your database so you do not communicate with an invalid device.</p>
<p>Using the feedback service is not covered by this tutorial.</p>
<p><strong> </strong></p>
<p><strong>Certificates</strong></p>
<p>The first thing you need is your Push certificates. These identify you when communicating with APNS over SSL.</p>
<p>Generating the Apple Push Notification SSL certificate on Mac:</p>
<ol>
<li>Log in to the <a href="http://developer.apple.com/iphone/manage/overview/index.action"><strong>iPhone Developer Connection Portal</strong></a> and click App IDs</li>
<li>Ensure you have created an App ID without a wildcard. Wildcard IDs cannot use the push notification service. For example, our iPhone application ID looks something like AB123346CD.com.mobilesnapp.iphone</li>
<li>Click Configure next to your App ID and then click the button to generate a Push Notification certificate. A wizard will appear guiding you through the steps to generate a signing authority and then upload it to the portal, then download the newly generated certificate. This step is also <a href="http://developer.apple.com/iphone/prerelease/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html#//apple_ref/doc/uid/TP40008194-CH104-SW4"><strong>covered in the Apple documentation</strong></a>.</li>
<li>Import your aps_developer_identity.cer into your Keychain by double clicking the.cer file.</li>
<li>Launch Keychain Assistant from your local Mac and from the login keychain, filter by the Certificates category. You will see an expandable option called “Apple Development Push Services”</li>
<li>Expand this option then right click on “Apple Development Push Services” &gt; Export “Apple Development Push Services ID123″. Save this as apns-dev-cert.p12 file somewhere you can access it.</li>
<li>Do the same again for the “Private Key” that was revealed when you expanded “Apple Development Push Services” ensuring you save it as apns-dev-key.p12 file.</li>
<li>These files now need to be converted to the PEM format by executing this command from the terminal:<br />
<em>openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12 </em><br />
<em> openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12</em></li>
<li>If you wish to remove the passphrase, either do not set one when exporting/converting or execute:<br />
<em>openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem</em></li>
<li>Finally, you need to combine the key and cert files into a apns-dev.pem file we will use when connecting to APNS:<br />
<em>cat apns-dev-cert.pem apns-dev-key-noenc.pem &gt; apns-dev.pem</em></li>
</ol>
<p>It is a good idea to keep the files and give them descriptive names should you need to use them at a later date. The same process above applies when generating the production certificate.</p>
<p><strong> </strong></p>
<p><strong>Payload Contents</strong></p>
<p>The <a href="http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1"><strong>payload</strong></a> is formatted in JSON, compliant with the RFC 4627 standard. It consists of several parts:</p>
<ul>
<li>Alert – the text string to display on the device</li>
<li>Badge – the integer number to display as a badge by the application icon on the device home screen</li>
<li>Sound – the text string of the name of the sound to accompany the display of the message on the device</li>
<li>This tutorial will only deal with the basics of sending a simple alert text string but this can also be another dictionary containing various options to display custom buttons and the like.<a href="file:///C:/Users/supatra/Downloads/Push%20Notifications%20Apple_21jul11.docx#_msocom_1">[CK1]</a></li>
</ul>
<p><strong> </strong></p>
<p><strong>Creating the payload</strong></p>
<p>Using PHP, it is very easy to create the payload based on an array and <a href="http://www.php.net/manual/en/function.json-encode.php"><strong>convert it to JSON</strong></a>:</p>
<p>$payload['aps'] = array(&#8216;alert&#8217; =&gt; &#8216;This is the alert text&#8217;, &#8216;badge&#8217; =&gt; 1, &#8216;sound&#8217; =&gt; &#8216;default&#8217;);</p>
<p>$payload = json_encode($payload);<br />
Echoing the contents of $payload will show you the JSON string that can be sent to APNS:</p>
<p>{&#8220;aps&#8221; : { &#8220;alert&#8221; : &#8220;This is the alert text&#8221;, &#8220;badge&#8221; : 1, &#8220;sound&#8221; : &#8220;default&#8221; }}</p>
<p>This will cause a message to be displayed on the device, trigger the default alert sound and place a “1″ in the badge by the application icon. The default buttons “Close” and “View” would also appear on the alert that pops up.</p>
<p>For the iPhone application, it is important for the user to be able to tap “View” and go directly to the server that generated the alert. To do this, we add an extra dictionary of our own custom values:</p>
<p>$payload['aps'] = array(&#8216;alert&#8217; =&gt; &#8216;This is the alert text&#8217;, &#8216;badge&#8217; =&gt; 1, &#8216;sound&#8217; =&gt; &#8216;default&#8217;);</p>
<p>$payload['server'] = array(&#8216;serverId&#8217; =&gt; $serverId, &#8216;name&#8217; =&gt; $name);</p>
<p>$output = json_encode($payload);<br />
The custom dictionary server is passed to the application on the device when the user taps “View” so we can load the right server. The JSON looks like this:</p>
<p>{ &#8221;aps&#8221; : { &#8220;alert&#8221; : &#8220;This is the alert text&#8221;, &#8220;badge&#8221; : 1, &#8220;sound&#8221; : &#8220;default&#8221; },</p>
<p>&#8220;server&#8221; : { &#8220;serverId&#8221; : 1, &#8220;name&#8221; : &#8220;Server name&#8221;)}</p>
<p>The size limit of 256 bytes applies to this entire payload, including any custom dictionaries.</p>
<p><strong> </strong></p>
<p><strong>The raw interface</strong></p>
<p>Once an alert is generated within Server Density, the payload is built and then inserted into a queue. This is processed separately so that we can send multiple payloads in one go if necessary.</p>
<p>Apple recommends this method because if you are constantly connecting and disconnecting to send each payload, APNS may block your IP.</p>
<p>As <a href="http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4"><strong>described</strong></a> by Apple:</p>
<p><em>The raw interface employs a raw socket, has binary content, is streaming in nature, and has zero acknowledgment responses.</em></p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/aps_provider_binary.jpg"><img class="aligncenter size-full wp-image-425" title="aps_provider_binary" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/aps_provider_binary.jpg" alt="" width="418" height="89" /></a></p>
<p><strong>Opening the connection</strong></p>
<p>The PHP 5 code to open the connection looks like this:</p>
<pre>$apnsHost = 'gateway.sandbox.push.apple.com';</pre>
<pre>$apnsPort = 2195;</pre>
<pre>$apnsCert = 'apns-dev.pem';</pre>
<pre>$streamContext = stream_context_create();</pre>
<pre>stream_context_set_option($streamContext, 'ssl', 'local_cert',</pre>
<pre>$apnsCert);</pre>
<pre>$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2,</pre>
<pre>STREAM_CLIENT_CONNECT, $streamContext);</pre>
<p>If an error has occurred you can pick up the error message from <code>$errorString</code>. This will also contain the details if your SSL certificate is not correct.</p>
<p>The certificate file is read in relative to the current working directory of the executing PHP script, so specify the full absolute path to your certificate if necessary.</p>
<p>Note that when testing you must use the sandbox with the development certificates. The production hostname is <code>gateway.push.apple.com</code> and must use a separate and different production certificate.</p>
<p><strong> </strong></p>
<p><strong>Sending the payload</strong></p>
<p>At this point, the code we use loops through all the queued payloads and sends them. Constructing the binary content to send to APNS is simple:</p>
<pre>$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0)</pre>
<pre>. chr(strlen($payload)) . $payload;</pre>
<pre>fwrite($apns, $apnsMessage);</pre>
<p>Note that the <code>$deviceToken</code> is included from our database and stripped of the spaces it is provided with by default. We also include a check to send an error to us in the event that the <code>$payload</code> is over 256 bytes.</p>
<p><code>$apnsMessage</code> contains the correctly binary formatted payload and the <code>fwrite</code> call writes the payload to the currently active streaming connection we opened previously, contained in <code>$apns</code>.</p>
<p>Once completed, you can close the connection:</p>
<pre>socket_close($apns);</pre>
<pre>fclose($apns);</pre>
<p>There are 3<sup>rd</sup> party tools that take care of push notifications for your app, like Urban Airship. I will be covering its implementation in my next blog spot. Please feel free to leave a comment.</p>
<div>
<h2>See Also</h2>
</div>
<p>You might find these additional sources of information useful for understanding and implementing push notifications:</p>
<ul>
<li>The reference documentation for <code>UILocalNotification</code>, <code><a href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/cl/UIApplication" target="_self">UIApplication</a></code>, and <code><a href="http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIApplicationDelegate" target="_self">UIApplicationDelegate</a></code> describe the local- and push-notification API for client applications.</li>
<li><a href="http://developer.apple.com/library/ios/documentation/Security/Conceptual/Security_Overview/Introduction/Introduction.html#//apple_ref/doc/uid/TP30000976" target="_self"><em>Security Overview</em></a> describes the security technologies and techniques used for the iOS and Mac OS X platforms.</li>
<li><a href="http://tools.ietf.org/html/rfc5246" target="_blank">RFC 5246</a> is the standard for the TLS protocol.</li>
</ul>
<p>Secure communication between data providers and Apple Push Notification Service requires knowledge of Transport Layer Security (TLS) or its predecessor, Secure Sockets Layer (SSL). Refer to one of the many online or printed descriptions of these cryptographic protocols for further information.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/07/how-to-implement-push-notifications-apple-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to implement Push Notifications: Android</title>
		<link>http://blog.mobilesnapp.com/2011/07/push-notifications-android/</link>
		<comments>http://blog.mobilesnapp.com/2011/07/push-notifications-android/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 20:35:18 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tech Tuesdays]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[C2DM]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[push notifications]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=374</guid>
		<description><![CDATA[This tutorial is for getting started with Android Cloud to Device Messaging (C2DM) on Android. In the iOS world this is known as “push notifications”. There are many good resources out there for getting started, but all of them, I felt, were lacking in one way or another, which is why I decided to put together [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/C2DM1.jpg"><img class="aligncenter size-full wp-image-377" title="C2DM1" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/C2DM1.jpg" alt="" width="432" height="322" /></a></p>
<p>This tutorial is for getting started with Android Cloud to Device Messaging (C2DM) on Android. In the iOS world this is known as “push notifications”.</p>
<p>There are many good resources out there for getting started, but all of them, I felt, were lacking in one way or another, which is why I decided to put together this tutorial of my own. A lot of my code and structure is borrowed from other posts that are referenced in the links at the end.</p>
<p>On the iPhone, notifications are easy to implement and include, since iPhone OS 3.  However, it’s a little more complex on Android. Additionally, the Google provided “<a href="http://code.google.com/android/c2dm/index.html"><strong>Android Cloud to Device Messaging</strong></a>” is only built into its OS starting from Android 2.2. That said, C2DM is not designed to just send simple messages, they can include any kind of payload and are used for all kinds of updates, not just text alerts:</p>
<p><em>&#8220;Android</em> <em>Cloud to Device Messaging (C2DM) is a service that helps developers send data from servers to their applications on Android devices. The service provides a simple, lightweight mechanism that servers can use to tell mobile applications to contact the server directly, to fetch updated application or user data. The C2DM service handles all aspects of queueing of messages and delivery to the target application running on the target device.&#8221;</em></p>
<p>What if we want to support Android 1.6+?  Fact: 1.6 and 2.1 make up 56.8% of deployed versions.  We can’t just ignore over half of the Android population.  We need an alternative to C2DM.</p>
<p><strong>C2DM Alternatives</strong></p>
<ul>
<li><strong>Polling</strong>. The application itself will periodically poll your servers to check for new messages. You will need to implement everything from queuing messages to writing the polling code. Alerts are no good if they are delayed due to low polling periods.  But the more frequently you poll, the faster your battery is going to die.</li>
<li><strong>SMS</strong>. Android can intercept SMS messages.  You could include a payload to tell the app what to do, but then why not just use SMS in the first place?</li>
<li><strong>Persistent connection</strong>. This would solve the problem of periodic polling but would destroy the battery life. Apple’s push notifications work well because there’s only ever 1 service connecting to Apple’s servers. This is also how the C2DM service works.  This means you don’t have every app leaving open connections.</li>
</ul>
<p><strong>Working with C2DM</strong></p>
<p>Google provides <a href="http://code.google.com/android/c2dm/index.html"><strong>detailed documentation</strong></a> and <a href="http://code.google.com/p/jumpnote/"><strong>sample</strong></a> <a href="http://code.google.com/p/chrometophone/"><strong>projects</strong></a> onhow to implement C2DM in your Android Java project. They also have <a href="http://groups.google.com/group/android-c2dm"><strong>a good mailing list</strong></a> with Google employees who actually reply in just a few hours. However, like Apple, their documentation is lacking on how to implement the server side aspects – the bit that actually sends the message from you to Google, and then onto the user.</p>
<p>The complex part of Apple’s service is setting up the SSL certificates. This isn’t necessary for Google but they do require a <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html"><strong>ClientLogin</strong></a> token, which is equally complex:</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/clientlogindiagram.png"><img class="aligncenter size-full wp-image-385" title="clientlogindiagram" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/07/clientlogindiagram.png" alt="" width="424" height="192" /></a></p>
<p><em>“With programmatic authorization implemented, your users can log into their Google account and grant access to their Google service data from inside your application. The application then contacts Google with the login data and requests access to a specified Google service. Once Google authorizes access, your application can access the Google service data, allowing the user to create, read, update, or delete service data as needed using your application interface.</em><em> </em></p>
<p><em>Authorization with the ClientLogin API is a step up from the “low-tech” approach, which required applications to include the user’s login name and password in every request to a Google service. With programmatic login, Google issues a token that can be referenced in all subsequent requests.”</em></p>
<p>Once you have that token you can then communicate with the C2DM service. How this might work in practice with a real app is as follows:</p>
<ol>
<li>The user launches your app on their Android device. You call the C2DM registration method.</li>
<li>After the user has logged in, Google provides a registration ID to uniquely identify the device. You must send that ID to your servers and store it so you can communicate with the user.</li>
<li>You send a message to the user using their registration ID. This consists of a POST to the Google C2DM service.</li>
<li>The user’s device receives the message and you handle it.</li>
</ol>
<p>Step 3 is the server side code that we’re going to deal with here. The other steps are all implemented in Java in the app itself, and are outside the scope of this tutorial.</p>
<p><strong>Sending messages to Google C2DM – ClientLogin authentication</strong></p>
<p>You first need to <a href="http://code.google.com/android/c2dm/signup.html"><strong>register to use C2DM</strong></a>. It’s recommended that you set up a separate Google account just for this. If you use a Google Account that is both a Google Account and a Hosted Google Account (through Google Apps) then you may have a conflict. In this case, the Hosted account will always get registered (<a href="http://groups.google.com/group/android-c2dm/browse_thread/thread/8ecea793d9101814"><strong>source</strong></a>).</p>
<p><em>“You can also try to request “HOSTED” instead of “HOSTED_OR_GOOGLE” in ClientLogin – the hosted account is enabled for C2DM if there are both a hosted and a consumer ( google ) account. If your domain is converted to use the new ‘consumer’ account style – the problem may go away as well, since the old consumer account will be renamed.”</em><em> </em></p>
<p>You then need to obtain the ClientLogin token for the account you registered with C2DM. The process is <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html"><strong>well documented</strong></a> and there are plenty of things you need to handle (like CAPTCHA and expiring tokens) but this Python sample code will get a token for you:</p>
<p>import urllib, urllib2</p>
<p>class ClientLoginTokenFactory():</p>
<p>_token = None</p>
<p>def __init__(self):</p>
<p>self.url = &#8216;https://www.google.com/accounts/ClientLogin&#8217;</p>
<p>self.accountType = &#8216;GOOGLE&#8217;</p>
<p>self.email = &#8216;example@gmail.com&#8217;</p>
<p>self.password = &#8216;password&#8217;</p>
<p>self.source = &#8216;Domokun&#8217;</p>
<p>self.service = &#8216;ac2dm&#8217;</p>
<p>def getToken(self):</p>
<p>if self._token is None:</p>
<p># Build payload</p>
<p>values = {&#8216;accountType&#8217; : self.accountType,</p>
<p>&#8216;Email&#8217; : self.email,</p>
<p>&#8216;Passwd&#8217; : self.password,</p>
<p>&#8216;source&#8217; : self.source,</p>
<p>&#8216;service&#8217; : self.service}</p>
<p># Build request</p>
<p>data = urllib.urlencode(values)</p>
<p>request = urllib2.Request(self.url, data)</p>
<p># Post</p>
<p>response = urllib2.urlopen(request)</p>
<p>responseAsString = response.read()</p>
<p># Format response</p>
<p>responseAsList = responseAsString.split(&#8216;\n&#8217;)</p>
<p>self._token = responseAsList[2].split(&#8216;=&#8217;)[1]</p>
<p>return self._token</p>
<p>(Code taken and modified from sample <a href="http://groups.google.com/group/android-c2dm/browse_thread/thread/e6c54485f04d4f82"><strong>posted here</strong></a>).</p>
<p>You need to replace <code>self.email</code>, <code>self.password</code> and <code>self.source</code> with your own credentials. The self.email and self.password are for the account you signed up to C2DM with and self.source can be anything identifying who you are to Google – <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Request"><strong>see here for details</strong></a>. If you’re using a hosted Google account then you need to change <code>self.accountType</code> too – <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Request"><strong>see here for details</strong></a>.</p>
<p>To execute this code you’d use:</p>
<pre>clientAuthFactory = ClientLoginTokenFactory()</pre>
<pre>clientAuth = clientAuthFactory.getToken()</pre>
<p><strong>Sending messages to Google C2DM – cd2m/send</strong></p>
<p>The payload you send to Google has a number of requirements, <a href="http://code.google.com/android/c2dm/index.html#server"><strong>as detailed in their documentation</strong></a>. You need to specify the registration ID the user’s device has sent you and also provides a collapse key:</p>
<p><em>“An arbitrary string that is used to collapse a group of like messages when the device is offline, so that only the last message gets sent to the client. This is intended to avoid sending too many messages to the phone when it comes back online. Note that since there is no guarantee of the order in which messages get sent, the “last” message may not actually be the last message sent by the application server.”</em></p>
<p>You’ll also notice that there is no required “message” field. This is because the payload can contain many “data” fields and it is up to your app to handle them. This might just be a single field called <code><strong>data.message</strong></code> that is displayed by your app, or you could use it to send any other kind of data to update the app. For example, we could use it to send the latest data from a server, upon receiving it, to automatically refresh the values in the app.</p>
<p>This sample Python code will build the request, get your ClientAuth token (using the class posted above) and then send it.</p>
<pre>class C2DM():</pre>
<pre>         def __init__(self):</pre>
<pre>               self.url = 'https://android.apis.google.com/c2dm/send'</pre>
<pre>               self.clientAuth = None</pre>
<pre>               self.registrationId = None</pre>
<pre>               self.collapseKey = None</pre>
<pre>               self.data = {}</pre>
<pre>        def sendMessage(self):</pre>
<pre>               if self.registrationId == None or self.collapseKey == None:</pre>
<pre>                       return False</pre>
<pre>               clientAuthFactory = ClientLoginTokenFactory()</pre>
<pre>               self.clientAuth = clientAuthFactory.getToken()</pre>
<pre>               # Loop over any data we want to send</pre>
<pre>               for k, v in self.data.iteritems():</pre>
<pre>                       self.data['data.' + k] = v</pre>
<pre>               # Build payload</pre>
<pre>               values = {'registration_id' : self.registrationId,</pre>
<pre>                                 'collapse_key' : self.collapseKey}</pre>
<pre>               # Build request</pre>
<pre>               headers = {'Authorization': 'GoogleLogin auth=' + self.clientAuth}</pre>
<pre>               data = urllib.urlencode(values)</pre>
<pre>               request = urllib2.Request(self.url, data, headers)</pre>
<pre>               # Post</pre>
<pre>               try:</pre>
<pre>                       response = urllib2.urlopen(request)</pre>
<pre>                       responseAsString = response.read()</pre>
<pre>                       return responseAsString</pre>
<pre>               except urllib2.HTTPError, e:</pre>
<pre>                       print 'HTTPError ' + str(e)</pre>
<p>&nbsp;</p>
<p>(Note this code is designed to be used in the same file as the previous sample code. If you separate them it requires <code>import urllib, urllib2</code>)</p>
<p>To use this code you need to call it like so:</p>
<pre>sender = C2DM()</pre>
<pre>sender.registrationId = 'hats'</pre>
<pre>sender.collapseKey = 1</pre>
<pre>sender.data = {'message' : 'Hello there', 'hats' : 54}</pre>
<pre>response = sender.sendMessage()</pre>
<p><strong>sender.data</strong> takes a Python dictionary, which will be converted to the right format to send to C2DM. Note that the <strong>sender.registrationId</strong> is not set – it should be the registration ID for the user you want to send to.</p>
<p><strong> </strong></p>
<p><strong>What else you need to do</strong></p>
<p>This sample code is useful for development but doesn’t do some things you’ll need for production:</p>
<ul>
<li>Error handling – you’ll need to do more advanced handling of any HTTP errors. If the Google service is down it’ll return a 503 HTTP code and a retry value, which you must honor.</li>
<li>You must queue messages if the service returns a quota error. This needs to use <a href="http://en.wikipedia.org/wiki/Exponential_backoff"><strong>Exponential backoff</strong></a>.</li>
<li>The ClientLogin code does not handle CAPTCHA or resetting the auth token. See <a href="http://groups.google.com/group/android-c2dm/browse_thread/thread/76af0bea6e65213a"><strong>this post for how this might be presented</strong></a>.</li>
</ul>
<p><strong> </strong></p>
<p><strong>Final words</strong></p>
<p>Push notifications on Android are fairly fragmented right now. The Urban Airship solution provided in my upcoming blog post will provide a good solution; but it requires installing a separate 3<sup>rd</sup> party app – not ideal.</p>
<p><strong>More resources listed here:</strong></p>
<ul>
<li><a href="http://code.google.com/android/c2dm/index.html" target="_blank">http://code.google.com/android/c2dm/index.html</a></li>
<li><a href="http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html" target="_blank">http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/07/push-notifications-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Submitting Your App to the Android Market</title>
		<link>http://blog.mobilesnapp.com/2011/06/submitting-your-app-to-the-android-market/</link>
		<comments>http://blog.mobilesnapp.com/2011/06/submitting-your-app-to-the-android-market/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 04:44:41 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tech Tuesdays]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Android Market submission]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[submitting apps]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=312</guid>
		<description><![CDATA[Finally, the moment you’ve been waiting for: submitting your completed app to the Android Market. The process is actually pretty straight forward: you just need to prepare a release version of the app and upload it. Preparing a Release Version of Your App You need to do a few things to get the app ready [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/android-market.jpeg"><img class="aligncenter size-full wp-image-316" title="android-market" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/android-market.jpeg" alt="" width="398" height="228" /></a></p>
<p>Finally, the moment you’ve been waiting for: submitting your completed app to the Android Market. The process is actually pretty straight forward: you just need to prepare a release version of the app and upload it.</p>
<p><strong>Preparing a Release Version of Your App</strong></p>
<p>You need to do a few things to get the app ready for distribution:</p>
<ul>
<li>Remove any debugging or logging code</li>
<li>Version the app</li>
<li>Compile the app</li>
<li>Sign the compiled app with a private key</li>
</ul>
<p><strong>Removing Debug Code</strong></p>
<p>There’s no reason to have debugging or logging code.  Those slow down your app while it’s running on a user’s phone.  You should open up the AndroidManifest.xml file in the KiloGap folder, search for “debuggable” and set it to false. When you are done, it should look something like this:</p>
<p style="text-align: left;"><em>&#8230;</em></p>
<p style="text-align: left;"><em>&lt;application</em></p>
<p style="text-align: left;"><em>android:icon=&#8221;@drawable/icon&#8221;</em></p>
<p style="text-align: left;"><em>android:label=&#8221;@string/app_name&#8221;</em></p>
<p style="text-align: left;"><em>android:debuggable=&#8221;false&#8221;&gt;</em></p>
<p style="text-align: left;"><em>&#8230;</em></p>
<p><strong>Versioning Your App</strong></p>
<p>Near the top of your AndroidManifest.xml file, you should see values set for the version name and version code for your app:</p>
<p><em>&#8230;</em></p>
<p><em>&lt;manifest</em></p>
<p><em>xmlns:android=&#8221;http://schemas.android.com/apk/res/android&#8221;</em></p>
<p><em>package=&#8221;com.jonathanstark.kilo&#8221;</em></p>
<p><em>android:versionName=&#8221;1.0.0&#8243;</em></p>
<p><em>android:versionCode=&#8221;1&#8243;&gt;</em></p>
<p><em>&#8230;</em></p>
<p>If this is probably your first app, these values are fine as is. Once you’ve published your app and later want to release an update, you’ll change these values appropriately. The Android system doesn’t      check or enforce this version information, but it’s a critical piece of data for your long term app strategy.</p>
<p>The version name is the value that will be shown to the user. It’s a string, so you can put whatever you want here, but the common practice is to use <em>a &lt;major&gt;.&lt;minor&gt;.&lt;point&gt;</em> format (such as 1.0.0).</p>
<p>The version code is expected to be a positive integer value. It need not correspond to the version name in any way. In fact, it probably won’t—you should just increment it by 1 every time you release an update, regardless of whether the release is a major upgrade or a minor bug fix.</p>
<p><strong>Signing Your App</strong></p>
<p>Android requires that all apps be digitally signed by the developer. The process for doing so is easy, but a little cryptic.</p>
<p style="text-align: left;">1) Launch the Terminal application and navigate into the KiloGap directory:</p>
<p><em>cd ~/Desktop/KiloGap</em></p>
<p><em> </em>2) Compile the app in release mode:</p>
<p><em>ant release </em><span style="font-style: normal;"> </span></p>
<p>You’ll see a page or so of output scroll by, ending with BUILD SUCCESSFUL. An unsigned binary named Kilo-unsigned.apk will now be sitting in the ~/Desktop/KiloGap/bin/ directory</p>
<ol><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/ch8-unsignedApk.png"><img class="aligncenter size-full wp-image-332" title="ch8-unsignedApk" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/ch8-unsignedApk.png" alt="" width="387" height="242" /></a>&nbsp;</p>
<p style="text-align: left;">3) Create a private key:</p>
<p><em>keytool -genkey -v -keystore keystore -alias alias -keyalg RSA -validity days </em></p>
<p><em> </em><em><em> </em></em></p>
<p style="display: inline !important;"><em><em><span style="font-style: normal;">This command is interactive and will ask you a bunch of questions. Mine looks like this:</span></em></em></p>
<p>JSC-MBP:KiloGap jstark$ keytool -genkey -v -keystore myAndroidKey.keystore \</ol>
<ol> -alias myAndroidKeyAlias -keyalg RSA -validity 10000<br />
Enter keystore password:<br />
Re-enter new password:</ol>
<ol>What is your first and last name?</ol>
<ol>[Unknown]: John Doe</ol>
<ol>What is the name of your organizational unit?</ol>
<ol>[Unknown]:</ol>
<ol>What is the name of your organization?</ol>
<ol>[Unknown]: Jonathan Stark Consulting</ol>
<ol>What is the name of your City or Locality?</ol>
<ol>[Unknown]: Cupertino</ol>
<ol>What is the name of your State or Province?</ol>
<ol>[Unknown]: CA</ol>
<ol>What is the two-letter country code for this unit?</ol>
<ol>[Unknown]: US</ol>
<ol>Is CN=John Doe, OU=Unknown, O=Jonathan Stark Consulting, L=Cupertino, ST=CA, C=US correct?</ol>
<ol>[no]: yes</ol>
<ol>Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with a validity of 10,000 days for: CN=John Doe, OU=Unknown, O=Jonathan Stark Consulting, L=Cupertino, ST=CA, C=US<br />
Enter key password for &lt;myAndroidKeyAlias&gt;<br />
(RETURN if same as keystore password):<br />
[Storing myAndroidKey.keystore]</ol>
<ol>When the process completes, you should see myAndroidKey.keystore created in the ~/Desktop/KiloGap directory. If you’d like to use this keystore for other apps in the future, you might want to move the keystore file to a more central location.&nbsp;</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_1.png"><img class="aligncenter size-full wp-image-341" title="submit_g_1" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_1.png" alt="" width="387" height="242" /></a></p>
<p>4) Sign your app with the key you just created:</p>
<p><em>jarsigner -verbose -keystore myAndroidKey.keystore</em></p>
<p><em>./bin/Kilo-unsigned.apk myAndroidKeyAlias</em></p>
<p>When you run this command, you’ll be asked for your keystore password.</p>
<p>5) Align the .apk file:</p>
<p><em>zipalign -v 4 ./bin/Kilo-unsigned.apk ./bin/Kilo.apk</em></p>
<p>You’ll see a page or so of output scroll by, ending with “Verification successful.” A signed binary named Kilo.apk will now be sitting in the ~/Desktop/KiloGap/bin/ directory. This .apk file is your completed app!</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_2.png"><img class="aligncenter size-full wp-image-351" title="submit_g_2" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_2.png" alt="" width="374" height="233" /></a></p>
<p><strong>Uploading Your App to the Android Market</strong></p>
<p>All that is left to do is upload our signed binary to the Android Market.</p>
<p>1. Launch your web browser, navigate to http://market.android.com/publish/, and sign in to your Google account.</p>
<p>2. If you aren’t forwarded automatically after logging in, navigate to <a href="http://market.android.com/publish/Home">http://market.android.com/publish/Home</a> and click the Upload Application button</ol>
<ol><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_3.png"><img class="aligncenter size-full wp-image-354" title="submit_g_3" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_3.png" alt="" width="374" height="303" /></a></ol>
<ol>3. Click the Choose File button next to “Application .apk file,” browse to Kilo.apk on your hard drive, and click the Upload button.</ol>
<ol>4. You can optionally upload a couple of screenshots to be displayed on the Market page for your app.</ol>
<ol>5. Enter a title for your app in the Listing Details section (30 characters max).</ol>
<ol>6. Enter a description for your app (325 characters max).</ol>
<ol>7. Select a type and category for your app.</ol>
<ol>8. Specify a price for your app.</ol>
<ol>9. Indicate your copy protection and location preferences in the Publishing Options section.</ol>
<ol>10. Enter your website address, email address, and phone number in the Contact Information section.</ol>
<ol>11. Agree to the terms in the Consent section.</ol>
<ol>12. Click the Publish button.</ol>
<ol>Congrats! Your app will be available in the Android Market almost immediately.&nbsp;</p>
<p><strong>Distributing Your App Directly</strong></p>
<p>One very attractive feature of the Android platform is that it lets developers skip the Android Market completely and distribute apps directly to users. This is a great option in many situations. For example, a corporate IT department might want to distribute a private app to employees. Or maybe you want to run a private beta of your app before uploading it to the Android Market.</p>
<p>Whatever the case, direct distribution couldn&#8217;t be easier: upload your signed .apk binary to your web server and provide your users with a link to it. Users click the link— say, from an email message or a web page—and the app is downloaded and installed. Simple.</p>
<p>The only caveat is that users have to first allow installation of non-Market applications by navigating to Settings→Applications and enabling the Unknown Sources option. If the user has not first enabled downloads from unknown sources, the user will still be allowed to download the app, but will be alerted that the install is blocked. The alert dialog will allow him to navigate directly to the relevant setting or cancel the installation. When the user first activates the checkbox, they will see a confirmation dialog that warns them about the implications of their choice.</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_4.png"><img class="aligncenter size-full wp-image-358" title="submit_g_4" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_g_4.png" alt="" width="369" height="234" /></a></p>
<p>&nbsp;</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/06/submitting-your-app-to-the-android-market/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Submitting Your App to iTunes App Store</title>
		<link>http://blog.mobilesnapp.com/2011/06/submitting-your-app-to-itunes-app-store/</link>
		<comments>http://blog.mobilesnapp.com/2011/06/submitting-your-app-to-itunes-app-store/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 20:04:07 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tech Tuesdays]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=244</guid>
		<description><![CDATA[It’s the moment you’ve been waiting for! You are submitting your completed app to iTunes App Store. There are several steps to this process, so you’ll want to have all your ducks lined up before you even think about submission. At a minimum, you’ll need the following to complete the app… Store submission process: A [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_app.png"><img class="aligncenter size-full wp-image-245" title="submit_app" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_app.png" alt="" width="410" height="124" /></a></p>
<p>It’s the moment you’ve been waiting for! You are submitting your completed app to iTunes App Store. There are several steps to this process, so you’ll want to have all your ducks lined up before you even think about submission. At a minimum, you’ll need the following to complete the app…</p>
<p>Store submission process:</p>
<ul>
<li>A plain-text description for the application (4,000 characters max).</li>
<li>A URL where people can learn more about your app.</li>
<li>A support URL and email address so people can contact you with issues pertaining to your app.</li>
<li>If your app requires a login, give full access credentials for a demo account so reviewers can test your app.</li>
<li>A 512 × 512 pixel icon.</li>
<li>A 320 × 480 pixel screenshot of your app.</li>
<li>A distribution provisioning profile for the app.</li>
<li>A zipped version of the application binary.</li>
</ul>
<p>Everything you need for submission is fairly straightforward except for the last two items &#8211; the distribution profile for the app and the application binary. I’m going to cover those in detail in the following sections.</p>
<h3>Creating an iPhone Distribution Provisioning Profile</h3>
<p>You need to create a distribution provisioning profile in order to submit your app to iTunes App Store.</p>
<ol>
<li>Navigate to the iPhone developer site (http://developer.apple.com/iphone/) and log in.</li>
<li>Click iPhone Developer Program Portal on the right sidebar.</li>
<li>Click on Provisioning on the left sidebar.</li>
<li>Click on the Distribution tab.</li>
<li>Click the New Profile button.</li>
<li>Choose App Store as your distribution method.</li>
<li>Enter a profile name (e.g., Kilo Distribution Provisioning Profile).</li>
<li>If you have not created a distribution certificate, you should do so before proceeding. If you see a link on this page labeled “Please create a Distribution Certificate,” click it and carefully follow the instructions. You’ll be making a couple of trips into the Keychain Access application (located in /Applications/Utilities) to create certificate signing requests and to install signed certificates that you download from the portal into your own keychain.</li>
<li>Select the appropriate App ID.</li>
<li>Click the Submit button (you’ll be returned to the Distribution Provisioning Profile list view).</li>
<li>Refresh the page until the Download button appears.</li>
<li>Click the Download button to save the profile to your local download directory (usually the Downloads folder in your Home folder).</li>
<li>Drag the downloaded profile into the Xcode icon on the dock.</li>
</ol>
<p style="text-align: center;">﻿<a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_1.png"><img class="aligncenter size-full wp-image-249" title="submit_1" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_1.png" alt="" width="423" height="351" /></a></p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_2.png"><img class="aligncenter size-full wp-image-250" title="submit_2" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_2.png" alt="" width="423" height="312" /></a></p>
<h3>Installing the iPhone Distribution Provisioning Profile</h3>
<p>Now that the profile is in Xcode, you need to configure the project to use it.</p>
<ol>
<li>Open Kilo in Xcode if it is not already open.</li>
<li>Select Edit Project Settings from the Project menu (the project settings window will appear).</li>
<li>Click the Build tab if it’s not already active.</li>
<li>Select Distribution from the Configuration pop up.</li>
<li>Select “Settings Defined at This Level” from the Show pop up.</li>
<li>Locate Code Signing→Code Signing Identity→Any iPhone OS Device in the main area of the window.</li>
<li>Click the pop-up list to the right of Any iPhone OS Device to display a list of profile options.</li>
<li>Locate your distribution provisioning profile in the list and select the distribution identity directly beneath it.</li>
<li>Close the Project Info window.</li>
</ol>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_3.png"><img class="aligncenter size-full wp-image-259" title="submit_3" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_3.png" alt="" width="411" height="328" /></a></p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_4.png"><img class="aligncenter size-full wp-image-260" title="submit_4" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_4.png" alt="" width="361" height="402" /></a></p>
<h3>Renaming the Project</h3>
<p>Before you submit your app, you need to rename it to Kilo. To do so:</p>
<ol>
<li>Open the project in Xcode.</li>
<li>Select Rename from the Project menu.</li>
<li>Type Kilo in the “Rename project to” field.</li>
<li>You can leave “Take Snapshot before renaming” checked if you want to save the state of the project prior to making the change, but it will significantly increase the amount of time it takes to process the request.</li>
<li>Click the Rename button.</li>
</ol>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_5.png"><img class="aligncenter size-full wp-image-269" title="submit_5" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_5.png" alt="" width="423" height="284" /></a></p>
<p>You will see a series of green circles with white checkmarks in them that indicate that the changes have taken effect.</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_6.png"><img class="aligncenter size-full wp-image-274" title="submit_6" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_6.png" alt="" width="413" height="269" /></a></p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_7.png"><img class="aligncenter size-full wp-image-277" title="submit_7" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_7.png" alt="" width="404" height="265" /></a></p>
<h3>Prepare the Application Binary</h3>
<p>Next, we need to build the application executable and prepare it to be uploaded.<strong> </strong></p>
<ol>
<li>Select iPhone Device &#8211; 3.1.2 (or the current version of the iPhone OS) from the Active SDK pop up, then select it again and pick Distribution. This should set the target to something like “Device &#8211; 3.1.2 | Distribution.”</li>
<li>Select “Clean All Targets” from the Build menu.</li>
<li>Select “Build” from the Build menu. You may be prompted to allow the application codesign to access your keychain. Allow it to do this so it can sign the app.</li>
<li>Make sure that you didn’t get any errors.</li>
<li>Reveal the app in the Finder.</li>
<li>Compress the app into a ZIP archive.</li>
</ol>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_8.png"><img class="aligncenter size-full wp-image-280" title="submit_8" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_8.png" alt="" width="369" height="651" /></a></p>
<h3>Submit Your App</h3>
<p>Now that you have everything you need:</p>
<ol>
<li>Log in to iTunes Connect (<a href="https://itunesconnect.apple.com/">https://itunesconnect.apple.com/</a>).</li>
<li>Click on “Manage Your Applications”.</li>
<li>Click on the “Add New Application” button.</li>
<li>Follow the onscreen instructions to proceed with the submission process.</li>
</ol>
<p>If all goes well, you should see your app listed as “In Review”.</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_9.png"><img class="aligncenter size-full wp-image-283" title="submit_9" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_9.png" alt="" width="411" height="306" /></a></p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_10.png"><img class="aligncenter size-full wp-image-288" title="submit_10" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/06/submit_10.png" alt="" width="423" height="124" /></a></p>
<h3>While You Wait</h3>
<p>Congratulations! You’ve officially submitted your app to the iTunes App Store!</p>
<p>Now what? You’ll probably have to wait a week or two to hear back from Apple. Here are some things you can do in the meantime to keep yourself busy:</p>
<ul>
<li>Set up a nice-looking web page for your app that is located at the URL that you submitted to Apple. Be sure to include the following elements:
<ul>
<li>A video of your app in action. Loren Brichter has posted a great tutorial on making beautiful iPhone screen casts at <a href="http://blog.atebits.com/2009/03/not-your-average-iphone-screencast/">http://blog.atebits.com/2009/03/not-your-average-iphone-screencast/</a>.</li>
<li>A brief description of your app. Just a paragraph or two and 5–10 bullet points.</li>
<li>An iTunes link to purchase your app.</li>
<li>A few testimonials, with a link to more if you have them.</li>
<li>A support email address. You could opt to set up a support forum instead, but you’ll learn more about your customers via email.</li>
</ul>
</li>
<li>Send personal email messages to bloggers who you think would be interested in your app. Target blogs that are relevant to the market for your app, and blogs that are about the iPhone in general.</li>
<li>Clean out your inbox. You’ll probably get about 5–20 email messages per 100 sales, so if your app is popular, you’re going to be getting a lot of email. Start with a clean slate!</li>
<li>Start working on your first upgrade. The more popular apps seem to upgrade about twice a month, which causes a steady buzz and lots of customer goodwill.</li>
</ul>
<p style="text-align: center;">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/06/submitting-your-app-to-itunes-app-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Apps that Actually Work</title>
		<link>http://blog.mobilesnapp.com/2011/05/mobile-apps-that-actually-work/</link>
		<comments>http://blog.mobilesnapp.com/2011/05/mobile-apps-that-actually-work/#comments</comments>
		<pubDate>Fri, 06 May 2011 15:49:47 +0000</pubDate>
		<dc:creator>cindy</dc:creator>
				<category><![CDATA[Main]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=232</guid>
		<description><![CDATA[An app’s success has as much to do with the experience that it delivers as it does the content it contains. At the end of the day, how users perceive your brand through your app is up to you.  When thinking about creating a mobile app be very clear about what results you desire out [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/app_game.jpg"><img class="aligncenter size-full wp-image-236" title="app_game" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/app_game.jpg" alt="" width="300" height="175" /></a></p>
<p>An app’s success has as much to do with the experience that it delivers as it does the content it contains.</p>
<p>At the end of the day, how users perceive your brand through your app is up to you.  When thinking about creating a mobile app be very clear about what results you desire out of your mobile app.  Do you want to interact with customers? …bring traffic into your stores? …educate people?</p>
<p><strong>“Me Too” Solutions</strong></p>
<p>The following are some ideas for basic apps.  A lot of companies and retails stores have implemented these and seen success.</p>
<ul>
<li>FEATURE: Location-based mobile apps.  GOAL: It’s the essential on-the-go tool, so people near you can find you.</li>
<li>FEATURE: Deals and coupons.  GOAL: Create customer loyalty and keeps your app on their phone.</li>
<li>FEATURE: News and product releases.  GOAL: Be the trusted source for latest and greatest information.  The Parenting Magazine mobile app has seen a ton of success due solely to its amazing content.  Read more: http://www.mobilemarketer.com/cms/news/content/9839.html</li>
</ul>
<p><strong>Forward Thinking Mobile App Ideas</strong></p>
<p>CREATE A TOOL.  Create a mobile app that is useful to the general public, regardless of whether it promotes your brand or not.  For example, the Allergycast mobile app, created by Zyrtec, tells you what allergens you might encounter that day depending on your location.  Regardless of whether you use Zyrtec or not, this mobile app is useful.</p>
<p>EDUCATE.  Offer the latest and greatest expert information on your topic of choice.  I was talking to a friend the other day and he mentioned that his career counselor blogs these amazing articles.  He gets something out of it every single time.  As we were chatting he was trying to recall a point in one of the articles.  With that he said to me, “I refer to [the career counselor’s] advice often during conversations throughout the day.  If only he had an app I’d show his articles to more people.”  Can you imagine what that could do for his counselor’s business and his credibility?  Opportunities missed.</p>
<p>MOBILE COMMERCE.  Offer your users the ability to buy via your mobile app.  What good is it to show them a bunch of product but not create an avenue for purchase?  I have seen this mistake being made over and over again.  If you want your customers to leave that app expecting them to purchase on your website (or worse, go to your store) you’ve already lost your customer.  Over and over again I have seen comments like this one:<br />
<a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/Gucci-feedback2.png"><img class="alignleft size-full wp-image-235" title="Gucci feedback" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/Gucci-feedback2.png" alt="" width="450" height="78" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Don’t let that be you!</p>
<p>CUSTOMIZATION.  People love the feeling of exclusivity.  If you can give it to them, do!  Nike has a mobile app that lets users design and customize their own shoes.  A Marc Jacobs apps lets users create and personalize their own purses.  Who wouldn’t want that?</p>
<p><strong>Recommendations</strong></p>
<p>Go where people are.  Extend your business onto a mobile platform.  Keep your apps lightweight and direct, focusing on the user experience and their take-away.  If you can adopt this mentality, I have no doubt that you’ll have a hit of an app on your hands.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/05/mobile-apps-that-actually-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing for Multiple Screens on Android – Part 2: Implementation</title>
		<link>http://blog.mobilesnapp.com/2011/05/developing-for-multiple-screens-on-android-%e2%80%93-part-2-implementation/</link>
		<comments>http://blog.mobilesnapp.com/2011/05/developing-for-multiple-screens-on-android-%e2%80%93-part-2-implementation/#comments</comments>
		<pubDate>Tue, 03 May 2011 21:44:52 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tech Tuesdays]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=201</guid>
		<description><![CDATA[The great thing about Android is also the same thing that annoys developers &#8211; the ability to run on multiple devices. When it comes to developing games or apps you need to think of how to incorporate the multiple screen resolutions so that it is compatible across the widest range of devices. Tackling this problem [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/htc-android-phones.jpg"><img class="aligncenter size-full wp-image-226" title="htc-android-phones" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/htc-android-phones.jpg" alt="" width="419" height="303" /></a></p>
<p>The great thing about Android is also the same thing that annoys developers &#8211; the ability to run on multiple devices. When it comes to developing games or apps you need to think of how to incorporate the multiple screen resolutions so that it is compatible across the widest range of devices.</p>
<p>Tackling this problem it was, at first, the most confusing part of Android development. Even with a very thorough article on the development website (<a href="http://developer.android.com/guide/practices/screens_support.html">Multiple Screen Support</a>), I still found it confusing. Let me walk you through how to setup your manifest and Eclipse workspace to achieve the desired results.</p>
<p>As mentioned in <a href="http://blog.mobilesnapp.com/2011/04/developing-for-multiple-screens-on-android-%E2%80%93-part-1-design/">Part 1 of this article series</a>, the way Android classifies different screen sizes are by pixel density. Once you&#8217;ve decided what your target hardware is, have a look again at the multiple screen guide.  Make sure to pay attention to the differences between &#8220;px,&#8221; &#8220;dp,&#8221; and &#8220;sp.&#8221;</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/screen-table.png"><img class="aligncenter size-full wp-image-205" title="screen-table" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/screen-table.png" alt="" width="422" height="177" /></a></p>
<p>Now a higher screen density means you can display more information, or pixels, in a smaller space. For example, if you just develop your game or app for a HVGA screen, when you try and run in on a WVGA screen it will appear smaller. In order to correct this you must make 3 different sizes for each PNG image you use.</p>
<p>In your Android Project in Eclipse, under the “res” folder, you will find the “drawable” folder. In order for Android to tell which folder contains the correct density images you will need to use qualifiers. To do this, delete the drawable folder and recreate 3 new ones named “drawable-hdpi”, “drawable-mdpi”, and “drawable-ldpi”. These will contain your different sized images and the naming will tell Android which folder to use depending on which device is running your application.</p>
<p style="text-align: left;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/res-folder.png"><img class="aligncenter size-full wp-image-210" title="res-folder" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/res-folder.png" alt="" width="288" height="188" /></a></p>
<p>If you develop your app or game using the HVGA screen size as recommended, to adjust your images you need to increase the image size by 1.5 times to get an HDPI image, and shrink it by 0.75 times to get a LDPI image. An example is the MDPI launcher icon. It is a 48&#215;48 PNG file. Times the resolution by 1.5 to get 72&#215;72, the size needed for a HDPI screen to display the icon at relatively the same size. And to get a LDPI image times the resolution by 0.75 to get 36&#215;36. Once you have converted all of your graphics to the appropriate size, you need to modify the Android Manifest.</p>
<p>To tell Android how to handle multiple screens you need to go to the “Android Manifest” -&gt; “Manifest extras” -&gt; then add the “Support Screens” option. Under the attributes for “Support Screens” you have small screen, normal screens, large screens, resizable and any density. My recommendation is for you to focus on the majority of Android devices.  20 out of 22 Android devices have normal screens.  It is up to you if you want to build for small or large screens.</p>
<p><strong>Resizable </strong>basically means fit to screen. So if there is a resolution that is out of the norm for Android, devices like 640&#215;480, then it will stretch the game to fit the screen. Otherwise it will just leave a black border.</p>
<p>If <strong>Any Density</strong> is false, then Android will only take resources from the “drawable-mdpi” and if the app is being run on a HDPI screen, it will auto convert the PNG up to the correct pixel density. I do not recommend doing this since it is not guaranteed to produce the desired results. Plus you want full control over your app and since we have already designated HDPI, MDPI, and LDPI folders we put Any Density to true meaning we can handling any density ourselves.</p>
<p>These are the setting that I usually use:</p>
<p>Small screens: <strong>false</strong></p>
<p><strong> </strong>Normal Screens: <strong>true</strong></p>
<p>Large Screens: <strong>false</strong></p>
<p>Resizable: <strong>true</strong></p>
<p>Any Density: <strong>true</strong></p>
<p><strong> </strong></p>
<p><strong>&lt;supports-screens&gt;</strong></p>
<p>The first step to proactively supporting screen sizes is to add the &lt;supports-screens&gt; <a href="http://www.androidguys.com/2010/02/23/handling-multiple-screen-sizes-part-3/">element</a> to your AndroidManifest.xml file. This specifies which screen sizes you explicitly support and which you do not.</p>
<p>Here is a manifest containing a &lt;supports-screens&gt; element:</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/multi-screen-manifest.png"><img class="aligncenter size-full wp-image-213" title="multi-screen-manifest" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/multi-screen-manifest.png" alt="" width="440" height="289" /></a></p>
<p>Three of these attributes are almost self- explanatory: android:smallScreens, android:normalScreens, and android:largeScreens. Each take a boolean value indicating whether your application explicitly supports those screens (true) or requires &#8220;compatibility mode&#8221; assistance (false).</p>
<p>The android:anyDensity attribute indicates whether you are taking density into account in your calculations (true) or not (false). If false, Android will pretend as though all of your dimensions (e.g., 4px) are for a normal-density (160dpi) screen. If your application is running on a screen with lower or higher density, Android will scale your dimensions accordingly. If you indicate that android:anyDensity = &#8220;true&#8221;, you are telling Android not to do that, putting the onus on you to use density-independent units, such as dip, mm, or in.</p>
<h2>Finding Your Size</h2>
<p>If you need to take different actions in your Java code based on screen size or density, you have a few options. If there is something distinctive in your resource sets, you can &#8220;sniff&#8221; on that and branch accordingly in your code. For example, as will be seen in the code sample at the end of this chapter, you can have extra widgets in some layouts (e.g., res/layout-large/main.xml) — simply seeing if an extra widget exists will tell you if you are running a &#8220;large&#8221; screen or not.</p>
<p>You can also find out your screen size class via a Configuration object, typically obtained by an Activityvia getResources().getConfiguration().</p>
<p>A Configuration object has a public field named screenLayout that is a bitmask indicating the type of screen the application is running on. You can test to see if your screen is small, normal, or large, or if it is &#8220;long&#8221; or not (where &#8220;long&#8221; indicates a 16:9 or similar aspect ratio, compared to 4:3). For example, here we test to see if we are running on a large screen:</p>
<p style="text-align: left;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/multi-screen-hack.png"><img class="aligncenter size-full wp-image-218" title="multi-screen-hack" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/05/multi-screen-hack.png" alt="" width="409" height="149" /></a></p>
<p>There appears to be no easy way to find out your screen density. If you absolutely need to know that, a &#8220;hack&#8221; would be to add a strings.xml file to res/values-ldpi/, res/values-mdpi/, and res/values-hdpi/ directories in your project. Put a string resource in strings.xml that has a common name across all three resource sets and has a distinctive value (e.g., name it ‘density’, with values of ldpi, mdpi, and hdpi, respectively). Then, test the value of the string resource at runtime. This is inelegant but should work.</p>
<p>To test out that this is working, make 3 Android Virtual Devices (AVD’s) and run your app. A WVGA or FWVGA, HVGA and QVGA should be good. I recommend making a specific PNG image in each density a different color, so you can tell if the right folder is being used.</p>
<p>If you read the article by Google linked at the beginning of this article it goes into more detail. Hope this makes sense and it helps you!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/05/developing-for-multiple-screens-on-android-%e2%80%93-part-2-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Mobile Apps Part of Developing a Mobile Strategy</title>
		<link>http://blog.mobilesnapp.com/2011/04/mobile-apps-part-of-developing-a-mobile-strategy/</link>
		<comments>http://blog.mobilesnapp.com/2011/04/mobile-apps-part-of-developing-a-mobile-strategy/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 16:12:57 +0000</pubDate>
		<dc:creator>cindy</dc:creator>
				<category><![CDATA[ForeSite]]></category>
		<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=189</guid>
		<description><![CDATA[Everyone is trying to come up with the next winning mobile marketing strategy, but has anyone hit the jackpot yet?  Companies and businesses seem to come up with new mobile strategies that get scrapped as fast as ice cream melts.  I have heard this over and over again as I meet and talk to people [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/mobile-strategy23.jpg"><img class="alignleft size-medium wp-image-194" title="mobile-strategy2" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/mobile-strategy23-300x112.jpg" alt="" width="300" height="112" /></a></p>
<p>Everyone is trying to come up with the next winning mobile marketing strategy, but has anyone hit the jackpot yet?  Companies and businesses seem to come up with new mobile strategies that get scrapped as fast as ice cream melts.  I have heard this over and over again as I meet and talk to people who are struggling with what to do with mobile.  They know they gotta get in the game, but the big question is HOW!</p>
<p>Let’s focus on mobile apps.  Many companies feel compelled to come up with ONE mobile app, which they deem their mobile strategy, that will carry their company for years to come, kind of like their website.  The thought is, “If I’m going to invest $50K into building an app it BETTER last a while and encompass everything my company has to offer.”</p>
<p>Let me ask you a question.  What, do you think, is the life expectancy of the average app?  In this day and age the amount of time an app is useful, usable and desirable is getting shorter and shorter.  In no time at all another app will pop up debunking last week’s BEST APP OF THE DAY!  What are you expectations around the life expectancy of your mobile apps?</p>
<p>Next question.  What, do you think, is the life expectancy of the average app on your phone?  I hazard to guess that some apps, the ones that you use all the time or the ones that add value to your life, live on your phone for quite a some time while the apps that don’t offer value get deleted after one or two uses.  Have you thought about how your mobile apps will fare on someone’s phone?</p>
<p>Think about these questions as you develop your mobile strategy.  The answers to these questions should drive your decisions on what kinds of apps you make, how long you expect these apps to be effective and how much you spend on app creation.</p>
<p>Tune in next week when I talk about what mobile strategies and apps I have seen that work really well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/04/mobile-apps-part-of-developing-a-mobile-strategy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing for Multiple Screens on Android – Part 1: Design</title>
		<link>http://blog.mobilesnapp.com/2011/04/developing-for-multiple-screens-on-android-%e2%80%93-part-1-design/</link>
		<comments>http://blog.mobilesnapp.com/2011/04/developing-for-multiple-screens-on-android-%e2%80%93-part-1-design/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 19:46:56 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tech Tuesdays]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=163</guid>
		<description><![CDATA[Unlike iPhones, Android devices do not have the same company developing both the software and hardware. This leads to different combinations of screen sizes, resolutions and DPIs creating quite a challenge when designing and developing for these devices.  While the iPhone 3G/S and iPhone 4 have different resolutions and DPI, they share the same screen [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/htc-android-phones.jpg"><img class="aligncenter size-full wp-image-164" title="htc-android-phones" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/htc-android-phones.jpg" alt="" width="419" height="303" /></a></p>
<p>Unlike iPhones, Android devices do not have the same company developing both the software and hardware. This leads to different combinations of screen sizes, resolutions and DPIs creating quite a challenge when designing and developing for these devices.  While the iPhone 3G/S and iPhone 4 have different resolutions and DPI, they share the same screen size and the resolutions follow the same aspect ratio.  Therefore, an image can be created to fit the iPhone 4’s specifications and be nicely scaled down to the iPhone 3G/S.</p>
<p>For some reason, the fragmented manufacturers of Androids do not give us that same luxury.  This leaves businesses with two choices – choose not to develop for Android, and willfully miss out on a <strong><span style="text-decoration: underline;"><a href="https://docs.google.com/viewer?url=http%3A%2F%2Fmetrics.admob.com%2Fwp-content%2Fuploads%2F2010%2F06%2FMay-2010-AdMob-Mobile-Metrics-Highlights.pdf">quarter of the market</a></span>,</strong> OR push forward and learn.  Sounds like a necessary evil, doesn’t it?  With my help, you will see that it’s not THAT bad.  There is common ground when designing and developing for the extremely versatile world of Android.</p>
<p><strong>Diving into the problem</strong></p>
<p>We can spend all day comparing “Apples to Androids”, but instead let’s jump right into what we’re dealing with here.</p>
<p><em><strong>Popular Android Devices</strong></em></p>
<p>Let me start by sharing a list of the most popular Android devices on the market today, with a few of their specifications.﻿</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-screen-sizes.png"><img class="aligncenter size-full wp-image-169" title="android-screen-sizes" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-screen-sizes.png" alt="" width="398" height="113" /></a></p>
<p>Looking at this list, two things should jump out at you.  First, that Google’s Nexus One is highlighted with an ugly, pale red. This is because this phone has been discontinued.  However, even though it is no longer in production, there is still a hefty number of Nexus One owners out there.  Second, did you notice the inconsistencies between screen sizes and resolutions?  They’re not exactly following a perfect pattern.  Take special note of how our friends at Motorola throw us a curve ball by adding a few extra pixels in their Droid line.  Thanks guys.</p>
<p>Below is a diagram showing the comparison of screen resolutions on Android devices.</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-resolution-sizes1.png"><img class="aligncenter size-full wp-image-175" title="android-resolution-sizes" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-resolution-sizes1.png" alt="" width="440" height="372" /></a></p>
<p>Because there are devices with different screen sizes that share the same resolution, we run into different densities (DPI/PPI).  Refer back to the popular device list and compare the HTC Evo and HTC Droid Incredible to see this difference.  The inconsistencies between the two aren’t so large that it’ll ruin the design one way or the other, but it does give you a good idea as to what DPI to choose when you begin designing.  So will the <a href="http://developer.android.com/resources/dashboard/screens.html">Android Developers Page.</a></p>
<p>Some of you are probably thinking, “This is old news.  We have been dealing with this issue on desktops and laptops for years.”  True, but the Android Platform gives us a few nifty tools to solve it this time.  Segue!</p>
<p><strong>The Solution</strong></p>
<p>The good news is that application developers can do most of the problem solving.  Not to delve too far into the technical side of things, which I will be covering in Part 2 of this series, the Android Platform provides the ability to use Density Independent Pixels (dip, as opposed to px) to define sizes of elements.  By using these units anything rendered through code will scale dynamically, ensuring a perfect fit no matter which screen is being used.  There are a few more suggestions on units like this.  Curious?  Check them out on the <a href="http://docs.huihoo.com/android/2.2/guide/practices/screens_support.html">Supporting Multiple Screens documentation</a> on the Android Developer’s page.</p>
<p>But what about pre-rendered assets, like images?  There are a few choices:</p>
<div>
<ol>
<li><strong>Use code for everything –</strong> Is this an easy solution?  Depends on the complexity of the design.  Does it result in beautiful, eye-catching apps? Probably not.  Is using code limited?  Oh yeah!</li>
<li><strong>Render separate images for all device/density scenarios –</strong> This is the easy way out.  Sure it’s the simplest way to make sure your images work on multiple screens, but it also increases the size of the application and slows it down.</li>
<li><strong>Design everything with the idea of Nine-Patch or tiled images in mind – </strong>An ideal solution for developers, but very limiting for designers.  See below for information on Nine-Patching.</li>
<li><strong>Render images for most used resolutions with the ability to stretch/tile cleanly –</strong> This is the most versatile solution.  Because the resolutions of Android devices do not share the same aspect ratio, using the same image for all devices will not work perfectly.  So, we worry about the most common, 240×340, 320×480, and 480×800.  Then we use Nine-Patch or tiled to make sure these images will fit properly for taller/wider screen.</li>
</ol>
</div>
<p><strong>Nine-Patch Images</strong></p>
<p>Nine-Patch is a tool that comes with the Android Development kit that allows us to specify which areas of our images are safe to stretch. The easiest way to understand this concept is through examples.  Here is an example of nine-patch in action.</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/nine-patch1.png"><img class="aligncenter size-full wp-image-178" title="nine-patch1" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/nine-patch1.png" alt="" width="402" height="256" /></a></p>
<p>The corners and logo stay intact as the rest of the image is stretched.  An important thing to remember is that you’re not limited to the perfect grid I used in the example; you can be creative with your nine-patching.  Nine patches can be as skewed as necessary to accommodate your design.  To learn more about Nine-Patch images, see the <a href="http://developer.android.com/guide/developing/tools/draw9patch.html">Draw 9-Patch </a>documentation on the Android Developer’s page.</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/nine-patch2.png"><img class="aligncenter size-full wp-image-181" title="nine-patch2" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/nine-patch2.png" alt="" width="426" height="847" /></a></p>
<p>I’m not going to get into tiling images, since the point of this article is to give designers an understanding of things to keep in mind when designing for Android’s multiple screens, not a “How-To” guide.</p>
<p>Even though all of these solutions will work, I strongly discourage rendering images for every possible screen size unless there is no possible way to nine-patch or tile your images.  If you can somehow work around the design limitations of solutions #1 or #3, that would be utopia for developers and the clients who want their app(s) on as many screens as possible.  With that, happy Android App designing!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/04/developing-for-multiple-screens-on-android-%e2%80%93-part-1-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 Tips for Developing Android Apps</title>
		<link>http://blog.mobilesnapp.com/2011/04/top-10-tips-for-developing-android-apps/</link>
		<comments>http://blog.mobilesnapp.com/2011/04/top-10-tips-for-developing-android-apps/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 18:49:35 +0000</pubDate>
		<dc:creator>sudeep</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Tech Tuesdays]]></category>

		<guid isPermaLink="false">http://blog.mobilesnapp.com/?p=145</guid>
		<description><![CDATA[Over the course of developing Android apps you may encounter various speed bumps.  I certainly ran into my fair share of them.  I painstakingly worked through each and every one of the issues.  I wish someone would have told me about all these ups and downs before I started my Android app development.  I’m going to [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-phones.jpg"><img class="aligncenter size-full wp-image-146" title="android-phones" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-phones.jpg" alt="" width="432" height="223" /></a></p>
<p>Over the course of developing Android apps you may encounter various speed bumps.  I certainly ran into my fair share of them.  I painstakingly worked through each and every one of the issues.  I wish someone would have told me about all these ups and downs before I started my Android app development.  I’m going to bequeath the things that I learned while tackling Android app development on to you. If you’re an Android app beginner, here are my top 10 tips for Android app development!</p>
<h3>1. Use a Global Theme</h3>
<p>Using a theme can save you from having to change styles for every Activity in your app.  Depending on the look and feel you want for your app, you should at least use the built-in Light or Dark themes. Tweak those styles in sub-activities if needed:</p>
<p>&lt;application android:icon=&#8221;@drawable/app_icon&#8221; android:theme=&#8221;@android:style/Theme.Light&#8221;  android:label=&#8221;WordPress&#8221; android:name=&#8221;WordPress&#8221;&gt;</p>
<h3>2. Design Flexible Layouts</h3>
<p>Android can run on multiple screen sizes. Make sure to use layout designs that stretch their content to fit the screen. Use “fill_parent” and “wrap_content” in the layout XML where appropriate to adapt the content of your application to the screen size automatically. Here’s an example from WordPress of different screen sizes:</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-sizes.png"><img class="aligncenter size-full wp-image-149" title="android-sizes" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-sizes.png" alt="" width="403" height="294" /></a></p>
<p>Check out <a href="http://android.svn.wordpress.org/trunk/res/layout/row.xml">row.xml</a> to see how the content is set up to expand in the comment view row.</p>
<h3>3. runOnUiThread() is Your Friend</h3>
<p>If you’re running threads in your application and need to display something to the user, you’ll discover that the application won’t actually display anything unless it is called from the main thread. You can use <a href="http://developer.android.com/intl/de/reference/android/app/Activity.html#runOnUiThread%28java.lang.Runnable%29">runOnUiThread()</a> to ensure that your code is run in the UI.</p>
<h3>4. Use Selectors as View Backgrounds, Not Images</h3>
<p>A common mistake, when coming from the web world, is to set the background for buttons and lists with an image file. Since Android has multiple states for views, you should create a custom selector in XML that details what should display when the view is in different states:</p>
<p>xmlns:android=&#8221;http://schemas.android.com/apk/res/android&#8221;&gt;     &lt;item android:state_selected=&#8221;true&#8221;         android:drawable=&#8221;@drawable/menu_button_bg&#8221; /&gt;     &lt;item android:state_pressed=&#8221;true&#8221; android:state_selected=&#8221;false&#8221;         android:drawable=&#8221;@drawable/menu_button_bg&#8221; /&gt;     &lt;item android:state_selected=&#8221;false&#8221;         android:drawable=&#8221;@android:color/transparent&#8221; /&gt; &lt;/selector&gt;</p>
<p><span style="font-size: 15px; font-weight: bold;">5. Handling Device Rotation</span></p>
<p>If you do nothing in your activity to handle device rotation, Android will default to restarting your activity. This is especially annoying if you are running a ProgressDialog while the application is working on something. You can override onConfigurationChanged() to have your activity stay alive when the device is rotated:</p>
<p>@Override public void onConfigurationChanged(Configuration newConfig) {   //ignore orientation change   super.onConfigurationChanged(newConfig); }</p>
<p>and in your manifest XML:</p>
<p>&lt;activity android:name=&#8221;selectCategories&#8221; android:configChanges=&#8221;orientation|keyboardHidden&#8221;&gt;&lt;/activity&gt;</p>
<p><span style="font-size: 15px; font-weight: bold;">6. Test on all Compatible Android Versions</span></p>
<p>Have 5 emulators up at once to test each version the app can run on (currently 1.5, 1.6, 2.0, 2.1 and 2.2).</p>
<h3>7. Optimize Your ListViews for Smooth Scrolling</h3>
<p>Wrap your ListView rows in a container class for faster loading and scrolling.</p>
<p><a href="http://stackoverflow.com/questions/1320478/how-to-load-the-listview-smoothly-in-android">StackOverflow has a good example</a>.</p>
<h3>8. Use DIP instead of PX</h3>
<p>To ensure that your margins and padding appears the same on different screen sizes and resolutions, make sure to use ‘dip’ instead of ‘px’ so that Android adjusts accordingly for the device:</p>
<p>&lt;button id=&#8221;@+id/example_button&#8221;              android:layout_width=&#8221;wrap_content&#8221;              android:layout_height=&#8221;wrap_content&#8221;              android:textSize=&#8221;20dip&#8221;              android:text=&#8221;Use Dips!&#8221;/&gt;</p>
<p><span style="font-size: 15px; font-weight: bold;">9. Android is Already Fragmented</span></p>
<p>Because Android is so open, device manufacturers have had to change a lot of the Android core. This can cause oddities to occur in your application. For example, take a look at how the app appears on the <a href="http://www.motorola.com/Consumers/US-EN/Consumer-Product-and-Services/MOTOBLUR/Meet-MOTOBLUR">Motoblur</a> platform:</p>
<p style="text-align: center;"><a href="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-motoblur.png"><img class="aligncenter size-full wp-image-155" title="android-motoblur" src="http://blog.mobilesnapp.com/wp-content/uploads/2011/04/android-motoblur.png" alt="" width="293" height="439" /></a></p>
<p>Agh, those black buttons! Motorola replaces the default Android buttons with black ones to fit their ‘dark’ theme for Motoblur. In order to correct this we have to create our own buttons for the app.</p>
<p><span style="font-size: 15px; font-weight: bold;">10. Use the Dev Tools Application</span></p>
<p>Google has created an excellent application that is installed by default in the emulators, but you can also install it on your device. My favorite tool in the app is the ‘Monitor CPU Usage’ option, which will put a few bars at the top of your device that show how much CPU your app is using in real-time! <a href="http://developer.android.com/intl/de/guide/developing/debug-tasks.html#additionaldebugging">Learn more about the Dev Tools here</a>.</p>
<p>There you go! Android is a great platform to develop for, and I hope this article will help you get started!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mobilesnapp.com/2011/04/top-10-tips-for-developing-android-apps/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

