Your First Android App

AndroidStudioIDE

We have published a new Android Tutorial over at the Android Studio Tutorial site.

Your First Android App – Hello World!

In this first tutorial we will do the traditional thing and write a “Hello World” Android app. This is very simple with Android Studio and doesn’t require any actual coding since the default app says Hello World. Nevertheless, it does demonstrate how to build an Android Project from scratch and understand the options in the New Project Wizard.

Installing Android Studio

Android Studio About

We are using the Developer Preview (version 0.4.0) of Android Studio at the time of writing. Installation details may change so visit the Android Studio site to check out the latest instructions and to download the relevant setup program.

From the Android Studio site:

Android Studio requires JDK 6 or greater (JRE alone is not sufficient). To check if you have JDK installed on a Mac (and which version), open a terminal and type javac -version. If JDK is not available or the version is lower than 6, download JDK from here.
To install Android Studio:
  1. Download the Android Studio package from above.
  2. Install Android Studio and the SDK tools:
    Windows:
    1. Launch the downloaded EXE file, android-studio-bundle-<version>.exe.
    2. Follow the setup wizard to install Android Studio.
      Known issue: On some Windows systems, the launcher script does not find where Java is installed. If you encounter this problem, you need to set an environment variable indicating the correct location.

      Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for exampleC:\Program Files\Java\jdk1.7.0_21.

    Mac OS X:
    1. Open the downloaded DMG file, android-studio-bundle-<version>.dmg.
    2. Drag and drop Android Studio into the Applications folder.
      Known issue: Depending on your security settings, when you attempt to open Android Studio, you might see a warning that says the package is damaged and should be moved to the trash. If this happens, go to System Preferences > Security & Privacy and under Allow applications downloaded from, select Anywhere. Then open Android Studio again.
    Linux:
    1. Unpack the downloaded Tar file, android-studio-bundle-<version>.tgz, into an appropriate location for your applications.
    2. To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh.
      You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.
That’s it! You’re ready to start developing apps with Android Studio.
Note: On Windows and Mac, the individual tools and other SDK packages are saved within the Android Studio application directory. To access the tools directly, use a terminal to navigate into the application and locate the sdk/directory. For example:
Windows: \Users\<user>\AppData\Local\Android\android-studio\sdk\

Mac: /Applications/Android\ Studio.app/sdk/

For a list of some known issues, see tools.android.com/knownissues.
To learn more about developing using this tool, visit our Android Studio Tutorial site.

Wire Frame & Prototyping Tools

design-evolution

Putting together a rough sketch or wire frame of your app design is always a good idea. Doing this will provide the following advantages:

  • It will assist you in communicating your idea to the developer, visual designer or others. It is much easier to get feedback on your ideas if you have a straw man to start the discussion with. The wire frame or prototype becomes your app blue print. You wouldn’t start building a house without plans (hopefully), similarly you should have a set of plans for your app.
  • It will save you money. It is a lot easier and cheaper to change something in the prototyping phase than it is once the app is finished.
  • It will save you time. Although taking the time to do a wire frame may seem like more effort, this will be repaid many times over during development and prevents false starts.
  • It will improve your design. By sketching out the design and explaining how a user will move from screen to screen it will quickly become obvious what will work and what won’t. Doing this will also prompt other ideas, work as a creative catalyst and ensure that you have thought of every eventuality.

There are many tools and resources available to help make prototyping and generating wire frames easier. Below are 26 resources which can be used to generate your wire frames:

  1. Keynotopia – Use PowePoint/Keynote to Prototype Like a Pro
  2. Justinmind – Rich interactive wireframes to define web and mobile applications
  3. Proto.io - Mobile prototyping
  4. UXPin – UX design tools built by UX designers
  5. AppGyver’s Prototyper – Turn wireframes into an interactive mobile app prototype
  6. App Mockup Tools
  7. WireKit – An iPhone app wireframe kit
  8. DevRocket – Photoshop panel plugin for iOS developers
  9. Fluid UI – Mobile Prototypes for iOS, Android and Windows Apps
  10. UI Stencils - Stencils, sketch pads and accessories for UI design
  11. App Cooker - Advanced iOS mockup generator for mobile applications
  12. Flinto – Quickly create iOS prototypes
  13. App Icon Template - App icon template for iOS 7
  14. PortKit – UX Metaphor Equivalents for iOS & Android
  15. iOS 7 Wireframe Kit
  16. SketchMirror - Preview your mobile apps directly on your devices
  17. Invision – Free Web & Mobile Mockup and UI Prototyping Tool
  18. Framer – Prototyping tool for animation and interaction
  19. Marvel – Free prototyping tool
  20. POP (Prototyping on paper) – iPhone App Prototyping Made Easy
  21. Mockabilly – App for creating mockups on iPhone
  22. Interface – Advanced mockup and prototyping for iOS
  23. Blueprint – Mockup iPad app for iPhone and iPad applications
  24. Proptotypes – Turn static designs intro a tappable iPhone prototype
  25. FieldTest – Create mobile interactive prototypes
  26. Dotted Paper

Development Complexity & Price

Difficulty

It is difficult to calculate how difficult an app will be to build, but it can be useful to know this when developing a quote for an app. There are a few different approaches that you can take.

You could use Halstead complexity measures which are software metrics introduced by Maurice Howard Halstead in 1977 as part of his treatise on establishing an empirical science of software development. Halstead made the observation that metrics of the software should reflect the implementation or expression of algorithms in different languages, but be independent of their execution on a specific platform. These metrics are therefore computed statically from the code using the following:

For a given problem, Let:

  • \,\eta_1 = the number of distinct operators
  • \,\eta_2 = the number of distinct operands
  • \,N_1 = the total number of operators
  • \,N_2 = the total number of operands

From these numbers, several measures can be calculated:

  • Program vocabulary:

\eta = \eta_1 + \eta_2 \,

  • Program length:

N = N_1 + N_2 \,

  • Calculated program length:

\hat{N} = \eta_1 \log_2 \eta_1 + \eta_2 \log_2 \eta_2

  • Volume:

V = N \times \log_2 \eta

  • Difficulty :

D = { \eta_1 \over 2  } \times { N_2 \over \eta_2 }

  • Effort:

E =  D \times V

The big problem with this approach is that you can’t calculate the metrics until you have written the code. This is problematic at the quotation stage of a project.

Our approach is based more on heuristics (i.e. educated guessing). By completing the following quick questionnaire we can come up with a score out of 100 which approximates the complexity and hence development effort required. This is used as an input into calculating the number of hours required and ultimately the cost.

Reefwing Complexity Matrix

  1. How customised is the user interface? Score from 0 for using the provided UI elements to 20 for a totally customised UI. Most game apps score a 20 for this, as everything from the buttons to the navigation bars need to be customised to suit the game theme. Utility apps are more likely to get a low score.
  2. How complicated is the underlying data model? This could vary from 0 for no persistent data to 20 for server based data. Using SQL or Core Data (for iOS) would be somewhere in the middle.
  3. How complex is the app? This relates to the app objective and may influence the other considerations. For example, an app with low complexity may simply display data. The other extreme would be an app that performs route mapping or language recognition. This dimension is a measure of what you are trying to do, the previous question on the data model is an element of how you are solving the problem. A lot of games can be surprisingly complex, an example of this would be if you were trying to build a decent AI for a 3D environment. Complexity will also influence how much code you will need to write which in itself will make life more difficult (have a look at the Halstead equations above).
  4. Who, what or how does the app have to communicate? You would score a 0 for this if the app was stand alone. The score would rise with the scale and type of networking required. You would also take into account how the networking was performed (e.g. Bluetooth, Wi Fi, etc) and how robust it needed to be (redundancy?).
  5. Does the app require 3rd party libraries or API’s? This could be ad servers, geo location, language recognition, translation services or anything similar. Score 0 for none and increase the score based on the number of interfaces. We also vary the score based on the maturity of the API and the API provider.

Once you have calculated your complexity score by adding the results from the five questions above you will get a number out of 100. We segment our apps into the following categories:

  • > 80: Insane:: You probably need to double the price you first thought of. Complexity increases exponentially (not linearly) with added elements because they all interact with each other.
  • 60 – 80: Difficult:: In this range you would double check everything and ensure that you have a tight specification. This app will likely take you longer than you expect and throw up things that you don’t expect. Add an extra 25 – 50% contingency.
  • 40 – 60: Average:: Most apps will fall into this range, no extra contingency should be required as long as the specification is solid and you have wire frames.
  • 20 – 40: Easy:: Should be a walk in the park. A good place for beginner developers to start.
  • 0 – 10: Simple:: There can never be too many fart apps.

We haven’t seen any other attempts to model app complexity but we would love to hear about the practices or thoughts of other developers.

Android Studio for App Development

Androidgears

At Google I/O 2013, Google launched a new Integrated Development Environment (IDE) based on IntelliJ IDEA, called Android Studio.

Android Studio provides integrated Android developer tools for development and debugging. On top of the capabilities you expect from IntelliJ, Android Studio offers:

  • Gradle-based build support.
  • Android-specific refactoring and quick fixes.
  • Lint tools to catch performance, usability, version compatibility and other problems.
  • ProGuard and app-signing capabilities.
  • Template-based wizards to create common Android designs and components.
  • A rich layout editor that allows you to drag-and-drop UI components, preview layouts on multiple screen configurations, and much more.
  • Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine as server-side components.

Android Studio includes a powerful code editor, which supports smart editing, advanced code refactoring, and deep static code analysis.

Smart editing includes inline resource lookups that make it easier to read your code. Code refactoring allows you to transform your code across the scope of the entire project.

Static code analysis helps you identify bugs quickly. On top of the hundreds of code inspections that IntelliJ IDEA provides, Google have added custom inspections. For example,  metadata to the Android APIs, that flag which methods can return null and which can’t, which constants are allowed for which methods, and so on. Android Studio uses that data to analyze your code and find potential errors.

Be aware that Android Studio is currently available as an early access preview. Several features are either incomplete or not yet implemented and you may encounter bugs. If you are not comfortable using an unfinished product, you may want to instead download (or continue to use) the ADT Bundle (Eclipse with the ADT Plugin).

Instructions for downloading the latest version of Android Studio are available here: http://developer.android.com/sdk/installing/studio.html. Versions are available for download on Windows, Mac OS X and Linux.

How much money will my app make?

For many people the whole point of writing applications is to see them published in the App store and available for download from iTunes. Before you quit your job and go out and buy matching Porsche 911′s you would be wise to get a few months of sales data under your belt. Like most endeavours, there is a bell curve of app sales. Everyone hears about Angry Birds developers making $70m, but there is a lot less media coverage at the other end of the bell curve.

In a recent survey of more than 1,500 developers in 83 countries, it was found that the average per-app revenue is roughly $1,200 to $3,900 depending on the platform. Additionally, the survey noted that an app has roughly a 35% chance of generating between $1 to $500. This obviously means that most developers cannot rely on app development as their main source of income. However, it does mean that if you put the effort in you can make enough to fund your development habit.

Our own experience is that you can never tell which Apps are going to be regular sellers (LifeGoals) and which will sink like a stone (LifeMovie). The Reefwing stable of Apps currently nets us around AUD$10k per annum, which is sufficient to purchase a MacBook Air, a new iPad, external development costs (Apple Developers Licence, App Sales Analytics, web-site and forum costs, etc.) plus a bit of change for the highly caffeinated beverages which programmers run on. Working mainly on on our contracted 3rd party apps we only work on these on the odd night and weekend so with more application we imagine the rewards would be better. The thing that we are no where near recovering is the time spent developing. The average App takes us about 3 months from start to finish and while the proceeds roll in for some years to come, it isn’t really passive income because sales quickly decline if you aren’t frequently updating your app.

However, lets face it – we would code if we didn’t get paid anything so anything we do get is a very pleasant upside. There is also something addictive about tracking the daily “sales” of you app (even if it is free).

The other thing that most developers don’t realise, is that the apps which are successful in the App store, have as much time and money spent on marketing their Apps as they do on developing them. There is the odd exception but these are an exception. Books have been written on this subject and we will provide our thoughts on the best approaches to marketing in another blog post.

Making Money From Apps

14 Ways to Monetize your App (courtesy of yourAppreport.com)

1. Paid Downloads aka Pay Per Download – Paid downloads work as users pay up-front to download your app once it’s available in one of the app markets. Paid download apps work well for apps in the gaming, entertainment, productivity, navigation and news categories. However, the more users pay up-front, the less tolerant they may be of advertising or in-app purchases. You might try considering to offer a free version plus a paid version of your mobile app with additional content that contains fewer or maybe even no advertisements.

2. In-App Advertising aka Mobile Ads – One of the most popular among mobile app developers. In-App Advertising works by allowing ads run on space sold within your app and revenue is based on number of user impressions and/or clicks. These really work well on the gaming, news, chat and entertainment category apps. However, the small drawback with in-app ads is that your app will have to bring back users regularly, and basically be designed for heavy use.

3. In-App Purchases or Subscriptions – In-App Purchases work by allowing users additional purchasing privileges, badges or subscriptions inside the app once they’ve downloaded it. These work pretty good for apps in the gaming, lifestyle and news categories. However, this type of app really requires a very loyal following of users that are willing to pay for virtual or ongoing benefits. You will need to regularly add fresh content as well.

4. Sponsorships – Sponsorships can work by individuals or businesses basically under-writing your app in exchange for recognition type benefits. An example of this would be maybe an ad or logo within your app. These work best for Local + Event focused apps and narrow focused audiences. The drawback here is that these are typically a one-shot source of revenue. They usually aren’t ongoing or scalable. However, it’s a pretty good way to get a first app off the ground.

5. Push Ads: Ads are displayed in the notification tray of an opted-in user’s device. CTR’s and conversion rates are sky high with this format, since there are no accidental clicks like with in-app ads. Advertisers pay on a CPC basis. Unlike traditional mobile ads, these ads are not placed inside apps. Each ad is also tagged with a permanent opt-out link, as well as the name of the app which delivered the ad. However, on iOS systems, you can get really crafty with Apple’s push notifications availability. (Be careful with that).

6. Icon Ads: Similar to the pre-installed apps which come with a new smartphone, Icon Ads are sponsored shortcuts (icons) placed on the home screen of an opted-in user’s device. Advertisers pay on a CPI basis for each icon installed on a device.

7. Dialog Ads: Ads are displayed as a dialog box inside an app, presenting the user with a 1 sentence call-to-action along with an OK and Cancel button. For example, the ad can ask the user “Check out a free new 3-d game” with an OK and Cancel button underneath. Advertisers pay on a CPC basis.

8. OfferWall Ads: Ads for individual promotional offers are placed in a single in-app interstitial and can be selected by a user for participation. Advertisers pay on a CPC or CPA basis.

9. Video Ads: High-quality Video Ads are shown in-app. Our proprietary ad server only displays Video Ads to users on a wi-fi or 4g connection, ensuring a positive viewing experience. Advertisers pay on a CPM basis.

10. Rich Media Ads: A full landing page is embedded inside an app, with a fixed close button at the top. Advertisers can build rich experiences which are directly embedded in another app.

12. Full-Page Banner Ads: Ad is displayed as an in-app interstitial to users, with a fixed close button at the top. Advertisers pay on a CPC basis.

13. AppWall Ads: AppWall a new interstitial mobile ad format that Advertisers can use to generate huge CTRs and higher engagement than virtually any other in-app ad type. Displayed within an app session, AppWall displays a variety of different offers and actively optimizes their placement in order to drive results that were never before possible in the mobile marketing space.

14. Affiliate Offers: A great way to monetize your app  is to leverage affiliate offers. There are 1000’s of affiliate offers available for almost any topic. When you hear “affiliate” you may be thinking someone has to pull out their credit card and purchase something from an online store and you will get a percentage… this is true, but there are also PPA affiliate offers (Pay Per Acquisition)- where you can get paid if one of your app users simply registers for a newsletter or website.  I have found these offers work great in apps.  Most people prefer to make affiliate purchases, with a credit card on their desktop computer, most people don’t want to pull our a credit card and type all those digits into their little smartphone screen. With PPC offers- you can show the user a relevant ad, the user can signup for a newsletter and you can get paid $1,2$ or more each time

Here are some affiliate sites to check out for PPA offers you could add to your app: