Click here to Skip to main content
15,867,327 members
Articles / Mobile Apps / Android

Introduction to Android

Rate me:
Please Sign up or sign in to vote.
4.90/5 (59 votes)
14 Jun 2015CPOL19 min read 85.5K   96   18
Kick start the learning journey to Android development with an introduction to Android, a comparison with other mobile platforms, followed by a high-level overview of Android architecture and the application components.

Image 1

Mobility Craze

I cannot think of a better way to describe the extreme mobility craze that we are experiencing today, but somehow coin it the M4W - Mobility Whoever Whenever Wherever Whatever (M4W). I think that plenty much sums up the phenomenon that happens in many parts of the Earth - from the poor to the rich, from rural to urban; everyone is looking at, what else? Mobile phones. I'm not kidding! Look at this.

Most if not all mobile phones are no longer just "phones", they are the kind of "Transformers" capable of transforming instantly into a Web browser, Camera, Video Cam, GPS navigator, Music player, Tablet PC, T.V., all at the touch of the finger tip. There is a more befitting name for these transformers - smartphone. Matter-of-factly, what everyone is holding in the palm is a micro-computers - micro in size but no less powerful than the conventional desktop or laptop computers. In the heart of every smartphone is a piece of software called mobile operating system that manages the phone hardware resources and provides services for other programs (aptly called apps). They are analogous to the operating systems in conventional computers - Microsoft Windows to IBM compatible PCs and OS X to Apple computers. From the great grandparent of all smartphones - IBM Simon in 1993, Palm Pilot in 1996, Nokia Communicator in 1998, Windows pocket PC in 2000, BlackBerry in 2002, Apple iPhone in 2007, to Android in 2008, Mobile operating systems have greatly evolved in the last 20 years. So much so that people are choosing mobile platform over conventional computer to perform a variety of tasks than ever before - such as internet banking, social networking, gaming, and many more. Welcome to the post-PC era!

According to a recently published mobile phone forecast from the International Data Corporation (IDC) Worldwide Quarterly Mobile Phone Tracker, Android remains the clear market leader among mobile operating systems with share expected to hit 80.2% in 2014 (Table 1).

Table 1: Worldwide Smartphone Forecast by Region, Shipments, Market Share and 5-Year CAGR (units in millions)
Operating System 2014 Shipment Volumes* 2014 Market Share 2018 Shipment Volumes* 2018 Market Share 2013-2018 CAGR
Android 997.7 80.2% 1,401.3 77.6% 12.0%
iOS 184.1 14.8% 247.4 13.7% 10.0%
Windows Phone 43.3 3.5% 115.3 6.4% 28.1%
BlackBerry 9.7 0.8% 4.6 0.3% -25.0%
Others 9.3 0.7% 37.7 2.1% 31.5%
Total 1,244.1 100% 1,806.3 100% 12.3%

Source: IDC Worldwide Mobile Phone Tracker, May 28, 2014

* CAGR stands for Compound Annual Growth Rate

* Forecast data

Aren't you amazed at how Android can overtake and stays well ahead of all its rivals in the global smartphone race in less than 6 years from its debut? Find out the answer yourself as you read on...

The Android Story

Android, symbolized by a green robot shown at the front of this article, is the open source mobile operating system designed, engineered, and maintained by the Open Handset Alliance (OHA) - a large consortium of 84 technology and mobile companies comprising Google, HTC, Sony, Dell, Intel, Motorola, Qualcomm, Texas Instruments, Samsung Electronics, LG Electronics, T-Mobile, and many others. The arrival of Android started to topple over things and pushed back the popularity of iOS which up until that time had been dominating the market.

Unlike iOS or Windows, Android is a completely open-source mobile operating system based on Linux kernel and released under the Apache v2 license which allows manufacturers and mobile operators to innovate using the platform without the need to contribute them back to the open source community. The code is freely available and can be modified by wireless handset manufacturers as needed to create custom mobile solutions. This has enabled Android to enjoy a very quick rise to market dominance.

Since its humble debut in the fall of 2008, Android has grown by leaps and bounds. During that time, it has undergone an unprecedently breathtaking rate of updates unlike any other development cycle. For the first year of Android’s commercial existence, OHA was rolling out a new version of mobile operating system every two-and-a-half months. The rest of the industry, however, is moving at a snail's pace. While Apple updates its iOS on a yearly cycle, Microsoft took 2 years to updates its version of Windows Phone from 7 to 8 and they still look very much the same. For Android users, they are lucky if anything looks the same this year as it did last year. The Google Play, for example, has undergone five major redesigns in five years. For Android, that is the norm.

Since April 2009, Android versions have been developed under a dessert-themed code name and released in alphabetical order: Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, and Jelly Bean. When the newest dessert (Oop! I mean version) released on 31 October 2013, OHA pleases all chocolate lovers by calling it Kit Kat! In November 2014, Android Lollipop - the latest version of Android was released.

The story of Android is best illustrated by this infographic in Figure 1, courtesy of socialcubix.com.

The Andriod Story

Infographic by socialcubix.com.

Figure 1: The Android Story

Android Everywhere

This relentless effort of continual improvement has propelled Android to its enormous success today. As of the fourth quarter of 2010, Android officially overtook its rivals as the most popular operating system for smartphones globally (Table 2).

Table 2: Mobile Operating Systems Race
Mobile Operating Systems Race

Since then Android has acted like a runaway horse and continues to increase its lead each and every quarter in the global market. Among other things, the number of new Android devices being activated each month continues to surge at a staggering rate. As of April 2013, approximately 1.5 million Android devices were being activated each day. As you can see from Table 3, Android has no where to go but up!

Table 3: Android's Scorecard
Android Smartphone
Number of daily activations of Android devices from August 2010 to April 2013
Global cumulative shipments of smartphones using the Android operating system from 2007 to 2016 (in million units)
Android Tablets
Global tablet shipments from 2010 to 2014, by operating system (in million units)
Android Apps
Cumulative number of apps downloaded from the Google Play Android app store as of July 2013 (in billions)

Android Everything

Although it started primarily as a mobile operating system targeting the smartphone market, Android has expanded its lineup to include a full assortment of tablets and laptops. Android is also used to power Google Glass and Google TV. In the future, Google plans to bring Android to watches and wearables with Android Wear and even to our living rooms with Android TV. On the other hand, the Open Automotive Alliance plans to bring Android to cars. In time to come, Android will become a full-fledged consumer operating system that exists in almost everything that we use everyday.

Android Unified

Since day one, one of the features that has always set Android apart from its fiercest rival is the freedom for users to add and use interactive widgets on their home screens. Android apps can include a widget as part of the installation package. Users can simply drag-and-drop widgets for their favorite apps anywhere on the home screen allowing them to interact directly from the homescreen of the device. This is a feature that is still not available in even the newest version of iOS. In more recent versions of Android, widgets are even available on the lockscreen of the device – a feature that has yet to be matched by any other mobile platform including Windows Phone and iOS.

In its latest release, 4.4 Kit Kat, Android offers a host of new features with the aim to improve the user experience. It has delivered more uniform experience for cross-hardware platform that can transition easily between various screen sizes and hardware configurations. The email application has been improved by borrowing many excellent features from the popular Gmail client. The lock screen has been improved to accommodate more customization. The status bar, Google Search integration, and Google Now have all been improved in Kit Kat.

Once dubbed "the ugly duckling" of the mobile industry, Android has transformed into a "beautiful and immersive swan" with a more polished design, improved performance, and new features, so much so that it now wins a string of design awards for its user interface.

Android for Developers

Android has always strived to foster a conducive development environment for its developers. After all, good developers are key to innovative development. They are more likely to create better and popular apps that draw consumers to the platform.

To publish on Google Play, a new Android developer only needs to pay a one-time registration fee of $25 (USD) to set up a publishing account that allows unlimited number of apps submission. Typically, apps are available for purchase and download within hours of submission. That is fast and efficient!

In comparison, to be able to distribute apps on the Apple App Store, an new iOS developer has to first sign up for an Apple Developer account, then enrol in Apple's iOS developer program which will set you back by $99 (USD) every year. Typically, a submission to the Apple App Store can take 4 to 6 weeks for approval before becoming available to consumers. In today's highly-competitive app marketplace, this time-to-market differential is significant.

Android applications can be created on any modern computers including Windows, Mac and Linux. All the tools required for setting up, developing, debugging and testing, to publishing Android applications are freely downloadable and can be installed and setup within an hour.

To provide strong support to its fellow Android developers, Google hosts an official site that provides all the information that is needed to develop an Android apps - software tools, design guide, development guide, distribution guide, API guide, reference, and project samples.

In an effort to promote and support developers' effort in developing high-quality Android apps that surprise and delight mobile users, Google had launched two Android Developer Challenge (ADC) competitions ADC1 and ADC2 for the most innovative applications for Android. Google offered USD 10 million in prizes, distributed between ADC1 and ADC2. ADC1 was launched in January 2008 and ADC 2 in May 2009. These competitions were a big hit and they drummed up a lot of excitement and publicity among developers, tech lovers, and ordinary consumers who were amazed at the amount of "unthinkable" tasks you could achieve with your Android phone.

You have seen the huge success of Android and its enormous potential, along with low-cost start-up, free development tools, quick time-to-market, and strong Google's support, aren't you tempted to jump on the bandwagon of Android development? Do not take too long to decide, lest you miss the ride.

For those who stay on, the journey shall begin. Our first stop is the Anrdoid Architecture where we will take a peek into the internal organs of Android operating system.

Android Architecture

Android operating system consists of a stack of software components divided into five sections and four layers as shown in Figure 2, starting from the bottom layer, namely Linux Kernel, Libraries and Android Runtime, Application Framework, and Application. Each layer uses the services provided by the layers below it.

Image 8

Figure 2: Android Architecture

Let's walk through them one by one.

Linux Kernel

Image 9

At the bottom of the Android stack is the Linux Kernel. It is the heart of the whole Android system. It provides services that handle all the low-level details of interfacing with the hardware components on behalf of the application programs. These services include:

  • Security

  • Networking

  • Device Drivers

  • Power Management

  • Process Management

  • Memory Management

  • Support for Shared Libraries

Libraries

Image 10

On top of Linux kernel layer lies the Android's native libraries layer. These libraries are programs written in C or C++. They provides instructions to guide the device in handling different types of data.

  • libc is a set of C/C++ libraries.

  • SGL is used to render 2D graphic.

  • SSL is responsible for Internet security.

  • FreeType is used to render bitmap and vector fonts.

  • Open GL|ES is used to render 2D or 3D graphic and video.

  • WebKit is the browser engine used to render HTML content.

  • Surface Manage is used for compositing windows on the screen.

  • SQLite is the database engine used for storage and sharing of application data.

  • Media Framework provides different media codecs to handle the recording and playback of various audio, video and picture formats.

Android Runtime

Located in the same layer as Android's native libraries, the Android Runtime contains two very important components, namely Dalvik Virtual Machine (VM) and the the core libraries.

  • Dalvik VM is a kind of Java Virtual Machine but is used in android devices to run apps and is specially designed and optimized for low processing power and low memory environments. The Dalvik VM allows multiple instances of VM to be created and run simultaneously by providing security, isolation, memory management and threading support. It is developed by Dan Bornstein of Google.

  • Core Libraries provide most of the functionality available in the core Java APIs which enable Android developers to write Android applications using standard Java programming language.

Application Framework

Image 11

Android is an open development platform. The Application Framework layer provides many higher-level reusable tools and services with which android app developers can make use of to build extremely rich and innovative applications without having to reinvent the wheel. Some of the more important components of Application Framework are:

  • Telephony Manager manages all voice calls.

  • Location Manager provide location awareness services.

  • Activity Manager manages the life cycle of activities in applications.

  • Content Providers manage the sharing of data between applications. It centralizes content in one place where many different applications can access it as needed. 

  • Resource Manager manages the various types of resources used by applications. They are static content that application code uses, such as bitmaps, colors, layouts, strings, etc.

Application

Image 12

Finally, we have reached the top layer - Application. This is where all the Android applications reside. This is the layer where users of Android devices would interact with for basic functions like making phone calls, messaging, broswering the Internet. Every Android device would have come pre-installed with serveral standard applications at this layer such as:

  • Dialer

  • SMS

  • Dialer

  • Contact

  • Web browser

Having browsed through the internal organs of the Android operating system, we will move on to the next stop - the Application Components that make up every Android Application.

Application Components

Although Android is Java-based, it is fundamentally different from Java programming. Android programming is organized into application components that work together to create every functional application. They are Activity, Service, Broadcast Receiver, and Content Provider. These four components are the essential building blocks of an Android application. They are loosely coupled and declared in the application manifest file called AndroidManifest.xml that describes each component of the application and how they interact. Let's understand the roles and responsibilities that they play in any Android application.

  • Activity – An Activity represents a single screen with a user interface on an Android device. A dailer application, for example, would typically have an activity (screen) on the device that consists of a dial pad with 10 number keys for dialing phone number and a text box above it for showing the numbers being dialed. An email application, on the hand, would have one activity that displays a list of incoming emails, another activity for reading a particular email, and yet another activity to compose an email. If an application has more than one activity, then one of them will be marked in the application manifest file as the main (initial) activity to run when the application is launched. One important point to note is that activities run in separate processes and they be called to do work by other applications (with permission). For example, the camera app can start the compose new mail activity of the email app to attach a photo to a new email.

  • Service – A Service does not have a user interface and is specifically designed to run in the background to perform long-running operations. An application can start a service and it will continue to run in the background even if the user switches to another application. For example, a service might handle network transactions, play music, or perform data synchronization, all from the background without inferring or blocking user's interaction with an activity on the foreground.

  • Broadcast Receiver – A Broadcast Receiver allows your application to register for system or applications generated announcements. All registered receivers registered for an announcement will be notified by the Android runtime when this announcement is broadcasted. You may liken announcements to events and broadcast receivers to event listeners in event-driven programming. Some of these announcements are generated by the system, such as battery low, or screen-lock, while others by user applications. For example, an application can broadcast an announcement on the arrival of some data (e.g. new mail arrival) to other applications. Broadcast receivers who registered for this announcement will be notified of this announcement and it is up to them to initiate appropriate actions, such as starting a new activity or service.

  • Content Provider – An Android application by default cannot access data belongs to another application. However, there are situations that require an application to share some data with others. Content providers provide such an interface to data so that the data can be shared across applications. A Content Provider manages a central respository of data that is shared across applications. Physically, data can be stored in the file system, in a SQLite database, or in any other persistent data location. Some examples of built-in Content Providers in Android are Contacts, MediaStore, Bookmarks, and Settings.The default Contacts application in Android has a Content Provider that can share contact information with other applications. It is no wonder that social media apps like Facebook and Google can sync with the existing contact information on your Android device.

Additional Components

There are additional components which are used in the construction of the four application components mentioned above, they are View, ViewGroup, Layout, Fragment, Intent, Resources, and Manifest.

  • View – Every item you see on the screen of an Android device is a View object. The View is the basic building block for user interface components in Android Apps. A View object occupies a rectangular area on the screen and is responsible for drawing and event handling. View objects are interactive UI widgets such as buttons, text fields, checkboxes, spinners, and many more. They can be likened to controls in windows forms or input types in web forms. They are usually grouped into different containers called ViewGroups.

  • ViewGroup – A ViewGroup is a special View that can contain other Views or ViewGroups. In OO's term, it is a subclass of View. A ViewGroup object is an invisible view containers that define how the child views inside the container are to be related or laid out. An example of a ViewGroup object is the RadioGroup object which contains multiple radio buttons such that only one can be selected at any one time. You may also liken a ViewGroup to the Panel control in windows forms or the div tag in HTML.

  • Layout – A Layout is a type of ViewGroup that defines how child views inside are positioned visually on the screen. In OO's term, it is a subclass of ViewGroup. Some of the commoner layouts are:

    • LinearLayout is a ViewGroup that displays child views are arranged in a single direction, either vertically or horizontally.

    • RelativeLayout is a ViewGroup that displays child views in relative position.

    • ListView is a ViewGroup that displays a list of scrollable items like a single column table.

    • GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid like a table.
  • Fragment – A Fragment represents a behavior or a user interface that must always be embedded in an activity. The main benefit of Fragment is modular design and reusability. You can combine multiple fragments in a single activity or reuse a fragment in multiple activities.

  • Intent – Intents are asynchronous messages initiated by some application components to request functionality from other Android components such as an activity, a Broadcast Receiver, or a Service, either within the same application or in another application. For example, an activity can send an Intent message to start an activity belonging to an camera app for taking a picture.

  • Resources - Resources are non-code assets, such as files, bitmaps, layout definitions, user interface strings, animation instructions, and more, that an Android application uses. The Android resource system keeps track of all these assets separately from the code. The Android SDK tools compile your application's resources into the application binary at build time. Using resources allows you to easily update the characteristics of your application without modifying code, and by providing alternative resources for different languages and screen sizes, you can optimize your application for a variety of device configurations. This is an important aspect of developing Android applications that are compatible on different types of devices.

  • Manifest – In every Android application, you will find a file called AndroidManifest.xml file in its root directory. Android system will not allow your app to run if it does not have this file. The manifest file is an XML file that holds all the configuration information about your app that the Android system must know before it allows to run any of the app's code - information from app’s name, icon, version, to hardware and software requirements, and it even filters the Intents that coming into the app. What a busy body right?. You may liken it to the Web.config file of an ASP.NET application. I would think of it as the command and control center of an app. Everything you want to know about the app or to do with the app, ask AndroidManifest.xml. Android Developers has a comprehensive list of what an Android Manifest does, check it out yourself.

Summing Up...

We have arrived at the first rest stop. This journey started with an insight into what Android is, how it compares to other mobile platforms, and hopefully that motivates you to start developing for Android. The second half of the journey covered a high-level overview of the Android Architecture and the various application components that make up every Android application. This journey serves as an necessary prelude to learning Android development. While looking forward to the next journey, we shall unwind and relax for now. See you soon. :java:

Reference

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Instructor / Trainer
Singapore Singapore
“Live as if you were to die tomorrow. Learn as if you were to live forever.”
― Mahatma Gandhi

子曰:"三人行,必有我师焉;择其善者而从之,其不善者而改之."

Comments and Discussions

 
QuestionJob Well Done Pin
bzskul23-Jul-17 5:56
bzskul23-Jul-17 5:56 
Generalmy votes 5 Pin
Member 1296087123-Jan-17 21:20
Member 1296087123-Jan-17 21:20 
GeneralMy vote of 3 Pin
Member 1296087123-Jan-17 21:19
Member 1296087123-Jan-17 21:19 
QuestionRegarding update up to Android 6.0 Marshmallow. Pin
Member 1193902417-Nov-15 18:45
Member 1193902417-Nov-15 18:45 
GeneralMy vote of 5 Pin
houziershi26-Oct-15 0:13
houziershi26-Oct-15 0:13 
GeneralMy vote of 5 Pin
Afzaal Ahmad Zeeshan11-Aug-15 8:21
professionalAfzaal Ahmad Zeeshan11-Aug-15 8:21 
QuestionA formidable introduction Pin
impalle9-Aug-15 9:22
impalle9-Aug-15 9:22 
GeneralNice Article Pin
Math08avan28-Jun-15 18:54
Math08avan28-Jun-15 18:54 
Generalandroid Pin
maxnis21-Jun-15 4:23
maxnis21-Jun-15 4:23 
GeneralMy vote of 5 Pin
Phebous18-Jun-15 18:42
Phebous18-Jun-15 18:42 
QuestionNicely written Pin
AiR_GuNNeR15-Jun-15 8:58
AiR_GuNNeR15-Jun-15 8:58 
GeneralThanks for entering! Pin
Kevin Priddle5-Aug-14 7:35
professionalKevin Priddle5-Aug-14 7:35 
GeneralRe: Thanks for entering! Pin
Peter Leow5-Aug-14 14:04
professionalPeter Leow5-Aug-14 14:04 
Thanks, Kevin.
Questionwifi connectivity in android Pin
Member 109893583-Aug-14 19:37
Member 109893583-Aug-14 19:37 
AnswerRe: wifi connectivity in android Pin
Peter Leow3-Aug-14 19:47
professionalPeter Leow3-Aug-14 19:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.