In this article, we describe how to build an app for Android. In another post we will explain how to do the same for iOS.
The goal of this article is to explain the overall steps in general. This is not a line-by-line code tutorial as that would be a very long document and you first need some background information. So here we give you basic information you need to have, an understanding of where you need to start, and what are the basic steps to writing apps for Android. In another post we will write a “Hello World” program to show how to write your first app.
The basic steps to building an app for Android are:
Come up with an idea.
Write the code using The Android Development Tool (ADT) plugin for Eclipse or the Android Studio.
Test the program on different versions of Android and different screen sizes and devices.
Upload the app to Google Play.
Hire a translator to translate the app it to different languages.
Upload bug fixes and upload new translations to Google Play.
The Android Developers Console
Google has two tools that you use to deploy apps to Google Play and to use Google services. You use the Android Developers Console
to upload your app and distribute it. Then, if you want to use certain Google services, like Google Maps or the Google Messaging Service, you sign up and get an API key from the Google Developers Console
. Those items are free until you hit a certain number of users, a very large number of users.
This is what the Android Developers Console looks like. You can see in this example that we have two applications. The screen shows the number of installs, the average rating, and the number of crash reports.
The screen below shows where you maintain translations. If you are distributing an app for the public then you should translate it into multiple languages as people around the world will download it, depending on whether it would be useful for them. You can find translators on the Upwork freelance market.
You have two choices to develop Android programs in Java (You could also use C++ if you are into that kind of torture.). You can use Eclipse and then add the ADT Android Development Tools plug-in or you could download the Android Development studio. Both are free.
If you use Eclipse, the basic steps are:
Add the ADT plug-in.
Install the Android SDK.
Run the SDK tools to install virtual images, the Google Play Service, different version of the SDK tools, and more.
ADT makes writing Android programs and working with devices easier than using Android SDK command line tools. For example, here is what Eclipse looks like when you open, for example, the Device view. That lets you see what devices are connected to your PC. (It is also a useful way to take a screenshot of the Android Device.) Note that in order to see this, you have to enable USB debugging under the Developer Options on the Android device.
To program Android, you need to know Java. Once you have figured that out, the best way to get started with Android is to take the Getting Started tutorial from the Android website
. As with everything else, any question you have you can type into Google and find an example on how to do things on StackOverflow. This site
also has a lot of excellent tutorials.
You will also want to study the Android Design Guide
to understand what widgets (screen objects like textboxes and push buttons) you should use to follow Google’s design philosophy. Plus reading that gives you an overview of what user interface objects are available. It also explains how to program to different size screens like tablets, smartphones, and TVs and screen orientations.
The main application for an Android application is called an Activity. An activity presents a screen as described in an XML file called a layout. All basic functions start from there. There are all kinds of Android classes that are extensions of the Activity base class. Which one you use depends on what you want your app to do. For example, the FragmentActivity lets you have different screens (fragments) that you can swipe into position with your finger.
Android Project Folder Structure
Here are some of the main folders and files you need to know about in an Android project. This is the Project Explorer view in Eclipse.
This is the same as regular Java. Your source code goes here.
This is where you tell the program what is the minimum and target versions of Android you want to support, which activity (screen) to launch when the app is opened, and what permissions your app needs (like Bluetooth, network information, location services, read the call log, permission to read contacts, and so forth.)
Your screen and menu layouts go here. You create those using wizards or just type the XML directly. Three of the folders below that are layout, menu, values, which are where you design screens, menus, and write text values to display on those menus and screens.
You copy different graphics and icons into the folders here. Each folder is used for different screen resolutions. Android looks in the folder and loads the icon that matches the screen resolution of the device when the program is launched.
Here is where you write the English language and other language translations for the text objects in your program.
When you write a program you have to consider that not every user will have the most recent version of Android on their tablet or phone. For example, if you program for Android 5 only, those programs will not work on Android 4. For that reason, Android provides support libraries to provide backwards support. You configure those dependencies in Eclipse. Most users today have at least Android 4 on their phone, but some will be using versions as old as Android 2.3.
You have to remember that not all people in all countries are rich enough to have the latest Samsung device. But this is not magic. If you want to support the older versions, you will have to use the older objects. So your code will look different for Android 5 than Android 4 and there will be different methods to implement. But it is not radically different.
Distributing an App to Google Play
In order to distribute an app to Google Play you have to generate a key to sign the app first. Don’t lose that key file or you will not be able to update your app and would have to create a brand new key and app if you want to make changes. That would be a disaster.
Also you will need to pick some graphics for the storefront and answer some questions like whether the app is age appropriate for all audiences. Then you translate the storefront text into the different languages you want to support. It takes about 6 hours to get an app published on Google Play. When you release updates Google will automatically push them out to your users over a few hours or days.
Developers who are writing apps for companies, and not the public, would use the Google Play Private Channel to distribute them. Of course your users could also turn off the security feature on their phone and let users just copy .apk files (i.e., the zipped-up app) directly there, but that is a bad practice as it opens you up to hackers.
Using Alternatives to Android
There are some alternatives to writing Android apps in Java. You can use Xamarin or Qt to write apps using one language. Then your app will run on iOS, Windows, and Android without rewriting the code, except there are some platform-specific considerations that you will need to program in the native language. That way you do not have to learn all three platforms and different programming languages.
We hope this tutorial has given you the basic information you need to get started with building an Android app. If you need help in developing an Android application for your business, we'd love to be of service.
Contact Us Today!
SHARE THIS BLOG ON