October 31, 2014

GUEST POST: Let's Make an Android App

android_academyThe following is a guest post from Carl Whalley of Android Academy.  Based in the UK, they’re doing their part to raise Android awareness across the pond.  After you are done reading through this article, we recommend heading over to their site and checking them out.  If you’re an Android developer or aspire to be one, you should start out with “10 Things Every Android Developer Needs to Know”. 

Why make an Android App?

Android marketplaceWith thousands upon thousands of Android Apps now available you might be forgiven for thinking it’s already too late. What could I possibly come up with that hasn’t already been done? Fear not – Paul McCartney thought the same when starting with the Beatles. The reason you can succeed is because the problem areas which apps aim to solve is gigantic, and you almost certainly have experience in some field which is unique enough to make a difference. It’s almost like saying what in my life is interesting enough to write a book about? You may think its really humdrum because of the sheer familiarity you have with your everyday routine – even if that’s working in a nuclear power station.

Get personal

Apps on phones are intensely personal. There’s something special about always having your device available, wherever you are,and something even more special about having it do something you created for it. Using them is a solo operation – you don’t get people looking over your shoulder like they do with a PC. You become intimately familiar with all its nooks and crannies. Your phone becomes an extension of yourself, and the apps onboard the means by which this wonderful tool is utilised.


Apps are created for different reasons:

  • To make a buck or two.
  • To solve a problem your way.
  • To solve a problem no one else has tackled yet
  • Sheer curiosity
  • As a loss leader
  • To raise your profile
  • Keeping up with the Joneses
  • Third party incentives

Whatever the reason, even seasoned veterans will tell you there are two buzz moments they get when writing apps. The first is when you first see it on your handset, or rather the first time it really begins to look like its getting in shape. It gets me every time – you get to see your idea made concrete, something you can actually prod and poke. Usually this starts a chain of thoughts … “yeah, that’s ok but it would be better if…” …. and so the development cycle begins. The second buzz is when you see someone else using your baby. If it’s a stranger thou shalt not pounce upon them with thy awesomeness. They might not like it.  Seriously … with Android there is no need – be strong, smile to yourself inside and remember that’s what the reviews are for.


Where to begin?

You begin with your idea. Forget the misconception that you need mega powerful computers and years of mobile experience – if your idea is good enough your app will find a way. Remember though the point about writing a book – no amount of dazzling linguistic skill can turn a turkey into a peacock. If you absolutely don’t want to code it yourself, there are numerous websites and discussion groups where you can post a call for help. I’ve found the Android community to be the most helpful of any I’ve encountered, and I think that’s got a lot to do with its open source roots combined with its biggest backer promising to do no evil ;-)

Get real

Clearly, it helps if you have a device available. In theory you could code something entirely using the emulator, that ‘s software which runs on your PC to display a simulated Android phone, and release it without ever seeing it hit silicon. My advice here is … don’t. Although the Android emulator is the best I’ve seen, and believe me I’ve seen a few, nothing can prepare an app quite for release like running it on a real handset. There are all sorts of funnies which arise in the real world which are difficult to simulate. What happens if a phone call comes in when your app is running? What happens when the battery dies? How about low memory? Are those colours really the best choice for bright light conditions?

Do yourself a favour and get kitted up for PC development. Ideally using Eclipse – I only say this because it’s the most popular so more likely to be able to get help for beginners for. Also all the Android Academy downloadable tutorials use it and you’ll notice in the various Google videos and presentations that it seems to be their choice too. And it’s free.  As ever though, there are excellent alternative IDEs (Integrated Development Environments) available, such as NetBeans, Idea etc, so choose which you feel most comfortable with.

The code

Now, if you are at all serious about making that killer app you will have to bite the bullet, roll up your sleeves, take the bull by the horns and write some software. There are so many newbie guides out there its hard to know where to start. Google is probably your best bet at http://developer.android.com/index.html, and don’t forget our getting started guide.

Assuming your PC is set up with your IDE and the Android SDK as described in those online setup guides, you’ll find every Android app starts as “Hello, World!”. This is a bit of a computer programmer in-joke. It’s the tradition for learning new languages and environments to create the simplest application which does nothing more that print “Hello, World!”. Go ahead – create an Android project with your IDE’s “New Android project” wizard and you’ll see it. Not only that but hook up your handset and you’ll be able to deploy it. And then the fun starts…


A little preparation goes a long, long way

There are a few rules of thumb which go into guesstimating the amount of time and effort which will go into an app. The first is to double every figure you first come up wit.   On an only-slightly more serious note, unless your app is really trivial some form of planning is in order. You should have an idea of at least how many screens your app will have and the path the user will take to traverse them. Draw them all out on paper first – it will help focus your thoughts. With Android, it does something else too – whilst you are in this planning stage it will rough out where in the app the various UI (User Interface) elements are to be defined, such as its buttons and dialog boxes. Not to get too technical so early on, but Android has a really elegant UI designer which is separate from any java code. It writes the layout definitions to an XML file behind the scenes, meaning you can go and tweak them as you become more familiar with the system. When your screens are mocked up on paper you can more easily translate them to this layout. Speaking of graphics, you’ll find it really useful to be at least on speaking terms with one of the major graphics packages like Fireworks or PhotoShop. Or a friend who is Android loves PNGs, which offer layers and transparency, so if you really want your apps to look half decent use your graphics package – and remember to polish your graphics as much as possible.

Show me the money

At this time you need to think about how your app is to be sold, if at all. Many altruistic souls do actually give away apps. It may be because the app itself is an ad for the people behind it – think of say a drinks manufacturer launching something which simulates vodka in a glass when you tip your phone up.  Other people just want to raise their own profile for future work. Most times though, you would want some return and the chosen method must be built in now and not bolted on afterwards.

The two immediate mechanisms are charging and ads. Charging is handled when you submit to the marketplace and so needs no development work on your part, unless you plan to also launch a “lite” version for free. Ads does mean work now – you need to download and use the Ad suppliers SDK to bake them in your app. Be aware that not all apps are suitable for ad display. A frantic arcade game might not be the best thing to have your users whisked off to another site if they tap the wrong area of the screen!

You should spend at least as much time testing your app as you do writing it. Ideally someone else should test it, and even more ideally on an Android handset you didn’t write it on. Far better to find bugs now before the Market rates it down before it gets a chance to even walk. Also, when you get serious about testing remember there is another way apart from prodding it on a handset – the automated unit test framework. As they say, this is way beyond the scope of this article but just be aware there is really good support for setting up a systems which lets your app test itself.

Test your app in as many ways as you can. If it uses net communication try it somewhere with no signal. If your battery is about to run out fire it up – does it corrupt all your data? How does it handle full memory situations? And finally, remember most of all this is a mobile phone you are using. What happens when your app is running and a call or text arrives?


Apps ahoy!

Once your masterpiece is ready you will want to publish it to the Android Market, so as many users as possible can use it. If it is to be sold you have to decide how much to charge – check any competition, if there is any. Get your lite version ready too, and ensure the version numbers sync up correctly. This can only really be determined on an app-by-app basis, so assuming it’s all worked out you need to sign it. This is mandatory for all Market apps but pretty painless (it’s all well documented in the SDK). The purpose is to stamp the app with your individual “electronic fingerprint” to ensure it’s not been tampered with, and provide some form of accountability. Finally, you need a developer account – a small one-off payment to Google – in order to log in to the Android app publishing site and upload your APK (that’s the file type for Android apps). Unlike other cumbersome publishing systems which shall remain nameless, your app will appear in the Market immediately.

Its probably worth mentioning that because you don’t need to use a 3rd party signing authority to sign the apps you save money. This is because the other platforms charge each and every time. Combined with the delay in returning the app, this beats say the iPhone situation hands down, where the language coming from the long-suffering developers at not being able to release would make a sailor blush.

Blow your trumpet

You also might want to give some thought to marketing beyond the Market, so to speak. With well over 10,000 apps available now it’s become a little crowded. To make yours stand out you might want to promote it externally. Again, this is all down to the nature of the app but there are a few things to go by:

  • Social networking – tweet it!
  • Specialised forums
  • Submit to Android focused websites for review
  • Write a press release on your own site/blog
  • Create a YouTube video
  • Host the app itself on your site, if it’s free

The only thing which would prevent your app appearing in the Market is if Google determine it has violated the terms you agreed to when you created the account. These cover things such as copyright breaches, suitable material etc. It’s always worth keeping up to speed with these which are details here.


Get ready for the critics!

Pour yourself a stiff one, or at least have your favourite tipple at this point – you’ve made it! Or have you? We are in the Web 2.0 world now, dominated by social networks, blogs and … user rating systems! Your app is now laid bare to every Tom, Dick and Harry who wants to spout forth upon its quality. And everything they say will be viewable right there in the Market for any new potential users, or more likely customers – which means it affects the amount of money made. Now its early days yet, but there have been one or two upsets caused by the ratings system, and especially the comments as things are not always as they appear. It’s even been said rivals want to throw a spanner in your works in order to boost their own apps standing. Whatever the outcome, you must now hope the majority of feedback is positive so your app doesn’t come running back with its tail between its legs. To be fair, Google have improved things recently and any obvious attempts to game the system will be looked into.

Monitoring & maintenance

What you must keep on top of now are the version numbers. When your app was signed, one of the mandatory fields in the AndroidManifest.xml file burnt into it the apps version. This does much more than let you keep your source in sync – it identifies it to the Market too. So when you make improvements or fix bugs, all you have to do is release it again with a higher version number and the users will be magically told of it without anyone having to do anything else. For this reason, its a good idea to invest in version control software – the most popular by far being Subversion, but you’ll need to invest some time in setting it up if you haven’t used one before. If you are at all serious about writing software, version control systems are pretty much essential – doubly so if you will be jointly developing code in a team.

So that’s it – the life and times of an app, from idea, to handset, to Market, user review then updates. Its a path many are treading now and one which, believe me, is one heck of a lot easier than in the old pre-Android days. You can tread a little more confidently now knowing your journey down that long and winding road will be more fruitful and blossom! ;-)