Pages

    Showing posts with label android. Show all posts
    Showing posts with label android. Show all posts

    Wednesday, February 16, 2011

    Learning Android: Appcelerator's Titanium vs. Native-built Apps

    I have finally been able to take the time to do something I've been wanting to do for a long time:  some mobile development.  I decided to work on some Android apps first, as the barrier to entry is a little lower.  As this was an exploratory mission, I thought I would give a few development options a try.  Those development options were native Android development via Eclipse and Appcelerator's Titanium Platform.

    By way of explanation, Appcelerator's Titanium Platform is a development environment that allows you to write HTML/CSS/JavaScript apps and have them compiled down to native code (Android or iOS).  Titanium provides a rich framework of APIs from which to build your apps.  For instance, the UI components in Titanium are analogous to the UI components in Android.  The advantage to Titanium is that you can take one app and compile it down to any of the supported platforms, like Android or iOS.  Since Titanium compiles down to native code, you're not running interpreted, though there are some specific wrappings that Titanium has to build in.

    The app:  Quotious

    For my app, I had a few necessities.  First, it had to be twitter-like, meaning that it was a bunch of short messages that can be displayed as a list.  I also wanted the data to be served up from some external source and arrive packaged in JSON.

    Based partly on these needs, and partly on an idea I got from a buddy, I decided to build an app that captured quotes.  You could specify the author of the quote, the source of the quote and the quote itself.  Nothing too fancy.  I called it "Quotious".

    In light of that, I first built out a small Jetty based server which I could run on my local.  It was backed by a MongoDB database.  The server simply served up the contents of the database in a RESTful manner (I really only implemented the GET).  I seeded the database with a bunch of quotes from Darth Vader, as he is a worthy source of quotes all over the interwebs.

    Then, I got to work building the apps.

    Titanium Quotious

    Titanium Quotious
    I decided to delve into Titanium first, as I was most excited about that.  While I can do all the Java programming anyone could ask for, I absolutely love working with JavaScript.  Titanium seemed like it would be a fun experience.

    From start to finish, it took me about two days to turn out the Quotious app in Titanium.  Titanium offers a great example app called "Kitchen Sink" that implements examples of an incredible number of their APIs.  I relied heavily on an example twitter app that comes included with Kitchen Sink, adapting it for my needs.

    The Titanium implementation of Quotious doesn't have a persistent store and pulls the data over a RESTful call every time you fire up the app.  In that manner, it's not very robust, but the real story here is that it was almost trivial to implement.  I was able to bring all of my traditional web app skills to bear and had I really been trying I could have turned it out faster.

    Native Quotious

    After I was done with the Titanium version of the app, I turned my hand to a natively built implementation done in Eclipse.  I quickly went through all the tutorials and found myself in an interesting position:  After Hello World, there wasn't a clear path to building up my understanding.  So, I turned to The Goog and found this superb implementation of a twitter app that is put together as a tutorial by Marakana.

    Native Quotious
    This app took me about twice as long to build, roughly 4 or 5 days.  The reason, though, is significant.  Titanium abstracts away much of the underlying Android structure.  You are free to basically build your app as if it were a web app and not worry about the inner workings of Android.  While those inner workings can only suffice to make your app stronger, they're not strictly necessary to simply build an app with Titanium.

    As I worked through the Marakana example, I was enlightened about all of the various moving parts that truly make up an Android app.  From the Manifest.xml to the views, from the actions to the intents, I had to actually learn what went into an Android app.  This accounted for much of the increased time of development.

    The native app that I developed is slightly more robust than the Titanium version.  It is backed by a SQLite database.  As updates are fed from the web source they are placed into the database.  As those changes go in, the UI is updated and what you see on the left is what is created.  In light of the database, my app will survive a loss of connectivity with grace, serving up what it has already seen and remembered in the past.

    Conclusion

    Let me not give the impression that Titanium is only about building web-app like Android apps.  It's not.  There is rich support for what makes a truly native app within Titanium.  You can create and manipulate a database, you can work with actions and intents.  You can do all of these things.  (Update:  See the first link below for some info on how to do all of these things)

    But you don't have to.  And therein lies what might be the most seductive thing about Titanium.  You can build your app as if it is a web app, only it runs natively.  You don't have to expand your skill set to understand all of the ins-and-outs of what makes up an Android app.  All you have to do is take your current skill set for building JavaScript heavy web apps and port them over to your device of choice.

    If developer time is your main constraint, then Titanium is likely the way to go.  You can hit the ground running faster with Titanium.  You don't really have to be an "app developer" to develop apps with Titanium.  What's more, and something I only lightly touched on, with very little augmentation, you can port your app to an entirely different platform such as iOS.  With very little, if any, changes, I can run the Titanium version of Quotious on an iOS device by simply compiling it down.

    One word of caution, though:  If you choose the Titanium route, don't eschew learning what really goes into an Android app.  Knowing the actuals behind Android can only make you a stronger developer in the long run.

    Edited:  For formatting
    Updated:  Added pointer to first comment with additional information

    Thursday, January 6, 2011

    Switching: iPhone to Android (Email)

    Once you're contacts are moved over, you need to move your email.  Now, let's be frank:  Gmail is one of the killer apps on the Android platform.  Though many a BlackBerry addict may disagree, it is by far the best email client on any mobile device.  It supports all of the major Gmail features:  threaded conversations, labels, search, etc.  The Gmail client on Android is light years beyond the native client on the iPhone, and once you get used to it, you won't want to go back.

    The problem here, though, is that the Android Gmail client works with just Gmail.  If you're already a Gmail/Google user, this is a non-issue for you.  When you sign into your Android phone, your mail will come over automatically.  You don't have to fuss or fret.  It'll just be there.

    If you're not a Gmail user you're faced with some decisions.  Once again we come back to the crux of the Android platform:  really getting the best out of Android requires a commitment to Google.  So, what are your options?

    Switch to Gmail
    The most effective, but probably the most drastic method (if you're committed to your email provider), is to switch your email over to Google and use Gmail lock, stock and barrel.  There are a lot of ways to do this.  Probably the easiest is to just start using Gmail without bringing any old messages along with you.  Send out the "this is my new email" message and call it a day.

    However, that might not be an option for a lot of folks.  History is important, and those old email messages are your history.  Taking them with you might be high on your list.

    If your old email provider is a POP provider, you can import your email into Gmail using the import feature.  Google has a great tutorial on the subject which will walk you through importing from some common email providers.  This method should really work for any POP provider, though, so even if your provider isn't on the list, don't give up, try anyway.  Don't forget to check the box that you'd like to be able to send email as from that account, too.  That way, you can still be seen as sending email from your old email address.

    Pro Tip:  You can still use your old email account through Gmail.  Setting it up this way, via POP, means that Gmail becomes your mail client, just like Outlook or Thunderbird.  The feature that really makes it possible is the one that allows you to select which account you're sending from.  When you create a message, click on the top of the compose message window where your Gmail address is and you'll get the option to select any account that has been verified.  Since Gmail is pulling your messages from your old account, and since you're sending messages as from that account, no one will know that you've changed.

    Another method revolves around using your current email client (including the iPhone) to connect to Gmail via an IMAP connection.  Once you do that, you can copy over any messages that you would like to keep on Gmail.  Here's a tutorial from the Gmail FAQ on how to go about it.  There's a second page attached to the first, linked to configuration instructions under the "Great, how do I get started?" heading.  Look for the configuration methods for your primary email client.  Just keep in mind, this is going to be a bit easier on a desktop.

    Switching to Gmail for the Insane Over-Achiever
    The above IMAP method works if you have a few hundred or so messages to copy over.  But, what if you have more? A whole lot more?  I found a great tutorial on setting up a local email server on your machine (looks like it's rather Windows-centric) and using that email server to move your files over via POP.  This is by no means a simple process, though.  Just keep in mind that this is for the advanced (and slightly crazy) user.  Attempt at your own risk!

    But I Love My Email Provider
    So, switching to Gmail isn't for you?  Don't despair, you're not completely up the creek, though you may be in for a sub-excellent email experience.  If you're on Yahoo, there is a Yahoo mail app that you can place on your phone.  As well, most modern Android phones ship with a native email client other than Gmail.  You should be able to set up that email client to connect to your old email via POP.

    Wrap Up
    Moving to a new email provider can be tough, traumatic work.  But in the end, it will make your life better, insofar as your Android phone is concerned.  The Gmail client on Android is the best email client out there, matching all of the major Gmail features.  Using it is a sheer joy, especially when you come from such an archaic email client as the native iPhone client.

    But, if switching isn't in the cards for you, you will still probably have options.  The great thing about Android is that there's an app for most anything.  You can most likely find a good email app to work with.

    Monday, January 3, 2011

    Switching: iPhone to Android (Contacts)

    First and foremost, you need contacts.  You certainly don't want to actually remember the phone number and email address of every person you know or have met in passing.  That's why smartphones were originally invented!  No, you probably have a whole slew of contacts stored in your iPhone.

    So, how do you get your contacts out?

    Unfortunately, the answer to that question is situational.  There are several ways to manage your contacts on an iPhone:  natively;  via Exchange;  via third party providers like Google or Yahoo.  If you're already using Google to manage your contacts on your iPhone, well, you're done.  For every other option there's a bit of elbow grease involved.

    Mail account type selection screen
    If You Already Use Your Google Account on Your iPhone
    It is important to note that there are two ways to set up your mail for Gmail on your iPhone, but only one of which allows you to sync your contacts.

    If you selected "Gmail" when creating your email account on your iPhone, this does not sync your contacts with Google.  You are also not getting "push" mail.  You're only checking the server every 15 minutes or so for your email.  If you created your Gmail mail account this way, then your contacts are being managed by other means.

    Example Google Account via Exchange
    However, if you get push mail, then you set up your Gmail account through the "Microsoft Exchange" option.  This will give you the ability to sync your contacts.

    You can check if you are syncing your contacts by going to Settings -> "Mail, Contacts, Calendars" and choosing your Gmail account (it will be named yourusername@gmail.com, most likely).  Choose that account, and if Contacts is set to "on" (as pictured on the right), then your contacts are already synced with your Google account.

    Pro Tip:  If Google is managing your contacts, then all of your iPhone contacts will appear in your "My Contacts" group in your Gmail account.  When you switch to Android, your Android phone will pull not only this group, but all of your contacts in Gmail, so you may end up with more contacts in Android than you have on the iPhone.

    Native:  Via iTunes
    If you use the iPhone Contacts app to natively manage your contacts, then they will be synced up with the iTunes profile for your phone.  Syncing your contacts into your Google account is rather easy, once you know what to do.  The basic gist is that there is an option in iTunes to sync your contacts to your Google account.

    Here are the how-tos from Google:

    For PC
    For Mac

    Via Exchange
    If you use Exchange to manage your contacts, email and calendar, then it's very likely that you are an enterprise user.  There's no easy and straight forward way to go from Exchange to your Google account, but there is a tried-and-true method for contacts:  the CSV file.

    The short answer:  Export your contacts from Outlook into a CSV (comma separated value) file, then import that CSV file into Gmail.

    There are literally hundreds of sites which can tell you how to do each of these steps, but here's an article on c|net which walks you through the process from start to finish on Outlook 2003 and 2007.  The article is from 2008 (meaning the Gmail import may be slightly different now-a-days), but should demonstrate the export process well enough:

    Exporting contacts from Outlook to Gmail

    Here's the Google help page for importing a CSV file into Gmail:

    Importing a CSV file into Gmail

    Pro Tip:  Even if your iPhone is using an Exchange account for your contacts, it doesn't necessarily mean that you're connecting to an Exchange server.  A lot of third party providers, for instance Google, use the Exchange format as it is a standard way to sync email, contacts and calendars on the iPhone.

    Via Third Party Providers
    If you use a third party provider other than Google to manage your contacts on your iPhone, then you will need to look up how to move from your third party account to your Google account.  Two of the big ones are Yahoo and Hotmail.  Keep in mind that this is more of a question of moving your contacts from your current provider to your Google account, not necessarily from your iPhone directly.

    For moving contacts from Yahoo to your Google account, look here:

    Import Yahoo contacts into Gmail (when you export, export for Microsoft Outlook, then follow the above instructions for importing a CSV file into Gmail)

    To move from Hotmail to Google, look here:

    Google Support on Moving from Hotmail to Gmail

    For any other providers, you will need to look them up individually.  A useful Google search is "export contacts from XXXXXX into Gmail", where XXXXXX is the provider you're using.

    Switching: iPhone to Android

    In case you missed it, Android is hot.  So hot, in fact, that according to Nielsen (as reported by Boy Genius Report) it's picked up the highest adoption rate in the past six months.  40.8% of all smartphones purchased in the last six months were Android phones.  While iOS still has the largest consumer footprint among smartphones in the US, with 28.6% of smartphones overall being iOS devices, Android devices have pulled to within 2.8%, with 25.8% of smartphones overall being Android devices, and the rate of growth far exceeds that of iOS.

    Given those figures, even if you're a current iOS fanboy user, it's highly likely that you've given some thought to what it would be like to switch to an Android phone.  You know, just thought about it.  But, how does one go about such a thing?  

    Switching smartphones is quite a daunting prospect, in some ways more difficult than switching computer OSes.  How do you get your contacts, email and calendar transferred?  What about the apps you use day in and day out?  The answers may surprise you.

    Before we get into the basics, though, let's talk about one of the killer, compelling reasons to use an Android phone:  Google.

    Most Android phones (some of the Samsung phones on Verizon being the notable exceptions) are tightly integrated with the Google experience.  By tightly, I mean that your contacts, email, calendar, IMs, etc will all reside in the cloud, synced with Google's servers.  This is a beautiful, beautiful thing.  If your phone ever dies or you switch to another Android phone, the fact that everything is synced in the cloud means that getting it all back is as easy as signing in to your Google account on your Android phone.  

    While using an Android phone without a Google account is doable, why would you want to do this?  Some of the true power of Android is derived from this close association with the Google services.  Another way to look at it is like this:  If you don't want to buy into the Google experience lock, stock and barrel, then an Android phone probably isn't for you.  

    It doesn't mean you have to use Google solely, there are great apps out there for things like Yahoo Mail and Messenger, for instance.  But, if you don't even want to set up a Google account and use the killer Google provided apps, then maybe you should stick with your iPhone.  You'll probably be a lot happier in the long run.

    The blog posts in this series are designed to give a bit of a walk through on switching from your iPhone to an Android phone.  We'll cover the basics, such as moving your contacts, email and calendar.  We'll also delve into some of the alternatives Android provides to the iOS ecosystem, like living without iTunes, or better yet, living with iTunes and Android.  We'll take a look at killer apps that you can't (and shouldn't) live without, and we'll look at shortcomings of both the iPhone and Android.  Finally, in the end there will hopefully be a clear path on how to migrate from your iPhone to an Android phone.

    Be forewarned, though:  This is not for the faint of heart.  It is not without pain and it's not as easy as pushing a button and making it go.  But, in the end, you can move from your iPhone to an Android phone, and when you do, you may never look back.

    Series Posts
    Switching Contacts

    Friday, August 13, 2010

    Double Fisting It on AT&T

    I have recently had to severely analyze my motivations for which phone I will get next.  Included in this analysis were factors such as work getting me a development phone, would I stay with AT&T and would I leave the iPhone behind.

    In answer to my last post, whether I would shift with the wind on which platform I wanted to commit to, the answer is both yes and no.  When I watched WWDC I became very excited about the iPhone 4.  What a gorgeous piece of hardware, and iOS has already proven to be a capable OS so I had no concerns there.  In short, there was much that was attractive to me about the iPhone 4.  Add in the capability to take slick 720p videos and edit them on-device and it seemed like a no-brainer.

    Then, antennae-gate hit.  It quite literally paralyzed me where I stood.  Could it be true, the vaunted iPhone 4 was a deeply flawed device?  Would simply holding the phone render it useless as a phone?  The echo-chamber of the gadget media covered the story in excruciating detail.

    As it turns out, it's not such a bad flaw, only showing up in low signal-strength areas.  Further, Apple is giving out bumpers with every iPhone 4.  The bumper mitigates the problem completely.  While I can't say that I love the thought that some high-end gadget has a design flaw which necessitates a case, the benefits of having an iPhone 4 greatly out-weigh the downsides.  Simply put, Apple has put out another superb machine for indoctrinating the masses and across the board all the pundits that have obtained one say it is a beautifully useful device.

    So, with the iPhone 4 back in the mix as a viable alternative (meaning I couldn't simply dismiss iOS and switch to Android), which phone would I get.  Ironically, work and AT&T provided the answer.

    Work has agreed to the necessity of development hardware and is allowing us to choose which device we would like.  We have to provide the service, should we want it, but by and large the choice of phone is ours.  The development team all agreed that Android was the way to go, as it is likely our customer will have Android phones at their disposal.

    Providing the service became a bit of a sticky wicket, though.  Did I really want another device, one that could be taken away at any time, and have to provide at least $40/month in service for it (on Verizon or AT&T)?  Did I want to switch to a lower tier provider like Sprint or T-Mobile?  Heck, did I want to carry around two devices with two numbers?  All of these questions came to mind, and I researched them to death.

    Turns out that Sprint and T-Mobile both have great plans which roll data into the plan.  On AT&T and Verizon, you have to pay ~$30 for data per smartphone and there is very little way around that.  However, the savings I would get on Sprint or T-Mobile weren't that much greater than what I have now.  If the answer had been that I could have my cost on my mobile bill go down $50/month, it would have been a no-brainer, but that is not the case.

    Adding to the complexity is the decision I made to have both major phone OSes at my disposal.  I would like to have my hand in both Android and in iOS, with an eye towards developing in both.  This requirement ruled out Sprint, but due to rumors did not rule out Verizon.  However, the modus operandi of AT&T provided a clear-cut answer.

    AT&T is a GSM carrier.  That means that the service each phone has is dependent on which SIM card is in the phone at any given time.  As long as I kept my iPhone plan/SIM, which provides data, SMS and phone service, I can switch my SIM into a different phone and still have all of that service, as well as keeping the same number.  It's a beautiful solution.  I could get both an iPhone 4 and an Android device and, depending on the necessity of the day, switch my SIM around to carry which phone I needed.

    Now, I have to find the right Android device on AT&T.  A Nexus One would suffice, but I will have to go to Ebay for one of those, so I may wait around and see what percolates out in the next few months.  Regardless, I believe I will be able to carry both OSes, and this makes my geeky heart very happy.

    Wednesday, May 26, 2010

    Wherever the Wind Blows

    Just recently I spent a couple of days watching the Google I/O 2010 keynotes live.  The first half of the second keynote was dedicated solely to Android 2.2 (codename Froyo, which is short for Frozen Yogurt) and man, I'm incredibly pumped about it.  Despite the fact that I don't have an Android phone, nor am I likely to get one anytime soon.

    It did get me thinking, though, about whether or not I will upgrade my iPhone come June 7 when the new iPhone is released.  It certainly has put a lot of hesitation in my mind.  Some of that hesitation is due to my frustration with the iPhone.  I recently decided that I would finally take the plunge and spring for the iPhone dev kit.  I amped myself up to start writing nifty apps on the iPhone and was completely gung-ho about the whole process.

    Only to find out that the only way to write apps on for the iPhone is on a Mac...  This caused me much angst.

    Enter Google I/O (and some Engadget reviews about the EVO and Incredible) and the wind started to shift.  By the end of the second keynote, I was committed to being an Android convert (with the added bonus that I could leave AT&T far behind).  However, there was a question niggling in the back of my mind:  Would my lust for a new iPhone reassert itself as I avidly watch the WWDC, where Apple will launch its new iPhone?

    As any good fanboy will do, I decided to seek out as much information as I could about Froyo and the current batch of devices everyone is talking about.  I turned to Mashable, Engadget and Ars, reading the same stories hashed and rehashed.  I downloaded all of the pertinent Engadget podcasts.  I devoured this info.

    And, hidden in there, I found an interesting tidbit of info:  A lot of these guys which are touting Froyo as the next coming of the mobile Jesus are reluctant to release their firm grasps on their iPhones.  In fact, during the Engadget show, an audience member asked a panel of Engadget editors if they would be willing to leave behind their iPhones for an Android device.  The answer, across the board?  "No."

    Here is an interesting perspective.  Has Apple done such a good job that even those that don't want to be indoctrinated are truly indoctrinated?  It's quite clear that the iPhone is the phone to beat.  This shows up whenever the latest, greatest phone is reviewed.  The question is always, is it an iPhone killer?  The answer every time so far is, "No."  In short, even though the pundits are crying out for a changing of the guard, they are unlikely to get one anytime soon.

    Even though the wind is blowing towards Android right now, will it be blowing that direction in two weeks?  I actually doubt it.  Don't get me wrong, Android is a worthy platform.  I want to develop for it.  It has some many things that make it ideal for our projects (more on that in another post).  It has strengths which are only now being developed and which, when they come to fruition, will be amazing.  But, for now, in the words of Paul Miller from Engadget, "Now is the best time to wait."

    So, I leave an eye to WWDC.  Will I be able to stomach another two years of AT&T and Apple (I highly doubt that Verizon will get an iPhone this time around)?  Will I find some way to secure the development environment which I so crave for iPhone OS devices?  An answer of yes to either of these two questions will indeed commit me to another tour of duty with an iPhone.