WHAT IS ANDROID:
Android is an open source and Linux-based operating system for
mobile devices such as smartphones and tablet computers. Android
was developed by the Open Handset Alliance, led by Google, and
other companies. Android offers a unified approach to application
development for mobile devices which means developers need only
develop for Android, and their applications should be able to run
on different devices powered by Android.
The first beta version of the Android Software Development Kit
(SDK) was released by Google in 2007 where as the first commercial
version, Android 1.0, was released in September 2008.
On June 27, 2012, at the Google I/O conference, Google announced
the next Android version, 4.1 Jelly Bean. Jelly Bean is an
incremental update, with the primary aim of improving the user
interface, both in terms of functionality and performance.
The source code for Android is available under free and open source
software licenses. Google publishes most of the code under the
Apache License version 2.0 and the rest, Linux kernel changes,
under the GNU General Public License Version 2
Why Android
History of Embedded device programming:
An embedded system is a combination of computer hardware and
software, either fixed in capability or programmable, designed for
a specific function or functions within a larger system. Industrial
machines, agricultural and process industry devices, automobiles,
medical equipment, cameras, household appliances, airplanes,
vending machines and toys, as well as mobile devices, are possible
locations for an embedded system.
Embedded systems are computing systems, but they can range from
having no user interface ( UI ) -- for example, on devices in which
the system is designed to perform a single task -- to complex
graphical user interfaces ( GUIs ), such as in mobile devices. User
interfaces can include buttons, LEDs, touchscreen sensing and more.
Some systems use remote user interfaces as well.
History of embedded systems
Embedded systems date back to the 1960s. Charles Stark Draper
developed an integrated circuit ( IC ) in 1961 to reduce the size
and weight of the Apollo Guidance Computer, the digital system
installed on the Apollo Command Module and Lunar Module. The first
computer to use ICs, it helped astronauts collect real-time flight
data.
In 1965, Autonetics, now a part of Boeing, developed the D-17B, the
computer used in the Minuteman I missile guidance system. It is
widely recognized as the first mass-produced embedded system. When
the Minuteman II went into production in 1966, the D-17B was
replaced with the NS-17 missile guidance system, known for its
high-volume use of integrated circuits. In 1968, the first embedded
system for a vehicle was released; the Volkswagen 1600 used a
microprocessor to control its electronic fuel injection
system.
By the late 1960s and early 1970s, the price of integrated circuits
dropped and usage surged. The first microcontrollerwas
developed by Texas Instruments in 1971. The TMS 1000 series, which
became commercially available in 1974, contained a 4-bit processor,
read-only memory (ROM) and random-access memory ( RAM ), and cost
around $2 apiece in bulk orders.
Also in 1971, Intel released what is widely recognized as the first
commercially available processor, the 4004. The 4-bit
microprocessor was designed for use in calculators and small
electronics, though it required eternal memory and support chips.
The 8-bit Intel 8008, released in 1972 had 16 KB of memory; the
Intel 8080 followed in 1974 with 64 KB of memory. The 8080's
successor, x86 series, was released in 1978 and is still largely in
use today.
In 1987, the first embedded operating system, the real-time
VxWorks, was released by Wind River, followed by Microsoft's
Windows Embedded CE in 1996. By the late 1990s, the first
embedded Linux products began to appear. Today, Linux
is used in almost all embedded devices.
Embedded system hardware (microprocessor-based,
microcontroller-based)
Embedded system hardware can be microprocessor- or
microcontroller-based. In either case, an integrated circuit is at
the heart of the product that is generally designed to carry out
computation for real-time operations. Microprocessors are visually
indistinguishable from microcontrollers, but while the
microprocessor only implements a central processing unit (CPU) and,
thus, requires the addition of other components such as memory
chips, microcontrollers are designed as self-contained
systems.
Microcontrollers include not only a CPU, but also memory and
peripherals such as flash memory , RAM or serial
communication ports. Because microcontrollers tend to implement
full (if relatively low computer power) systems, they are
frequently put to use on more complex tasks. For example,
microcontrollers are used in the operations of vehicles, robots,
medical devices and home appliances, among others. At the higher
end of microcontroller capability, the term system on a chip (SoC)
is often used, although there's no exact delineation in terms of
RAM, clock speed and so on.
The embedded market was estimated to be in excess of $140 billion
in 2013, with many analysts projecting a market larger than $20
billion by 2020. Manufacturers of chips for embedded systems
include many mainstays of the computer world, such as Apple, IBM,
Intel and Texas Instruments, as well as numerous other companies
less familiar to those outside the field. Arm has been a highly
influential vendor in this space. The company began as an outgrowth
of Acorn, a U.K. maker of early PCs. Arm chips, produced under
license by other companies, are based on the reduced instruction
set computer ( RISC ) architecture and are often used in mobile
phones; they remain the most widely deployed SoC in the embedded
world, with billions of units fielded.
Embedded system software
A typical industrial microcontroller is unsophisticated compared to
the typical enterprise desktop computer and generally depends on a
simpler, less-memory-intensive program environment. The simplest
devices run on bare metal and are programmed directly
using the chip CPU's machine code language.
Often, embedded systems use operating systems or language platforms
tailored to embedded use, particularly where real-time operating
environments must be served. At higher levels of chip capability,
such as those found in SoCs, designers have increasingly decided
the systems are generally fast enough and the tasks tolerant of
slight variations in reaction time that near-real-time approaches
are suitable. In these instances, stripped-down versions of the
Linux operating system are commonly deployed, although other
operating systems have been pared down to run on embedded systems,
including Embedded Java and Windows IoT (formerly
Windows Embedded ).
Generally, storage of programs and operating systems on embedded
devices make use of either flash or rewritable flash memory.
Embedded firmware
The firmware on embedded systems, referred to as embedded
firmware , is specific software written into the memory of a device
that serves the purpose of ROM, but can be updated more easily.
Firmware can be stored in non-volatile memory devices including
ROM, programmable ROM , erasable PROM or flash
memory. Embedded firmware is used to control various device and
system functions, for example, telling the device how to
communicate with other devices, perform specific functions and
provide input and output functionality.
The delineation between the terms embedded
firmware and embedded software are blurring, but
embedded software often refers to the only code running on a piece
of hardware, while firmware can also refer to the chip that houses
a device's basic input/output system ( BIOS ) or Unified Extensible
Firmware Interface ( UEFI ), which connect software and a system's
operating system.
Embedded systems vs. VLSI
Very-large-scale integration, or VLSI , is a term that
describes the complexity of an integrated circuit. VLSI is the
process of embedding hundreds of thousands of transistors into a
chip, whereas LSI (large-scale integration) microchips contain
thousands of transistors, MSI (medium-scale integration) contain
hundreds of transistors, and SSI (small-scale integration) contain
tens of transistors. ULSI, or ultra-large-scale integration, refers
to placing millions of transistors on a chip.
VLSI circuits are common features of embedded systems. Many ICs in
embedded systems are VLSI, and the use of the VLSI acronym has
largely fallen out of favor.
Debugging embedded systems
One area where embedded systems part ways with the operating
systems and development environments of other, larger-scale
computers is in the area of debugging . While programmers
working with desktop computer environments have systems that can
run both the code being developed and separate debugger
applications that monitor the actions of the development code as it
is executed, embedded system programmers generally cannot.
Some programming languages run on microcontrollers with enough
efficiency that rudimentary interactive debugging is available
directly on the chip. Additionally, processors often have CPU
debuggers that can be controlled -- and, thus, control program
execution -- via a JTAG or similar debugging port.
In many instances, however, programmers of embedded systems need
tools that attach a separate debugging system to the target system
via a serial or other port. In this scenario, the programmer can
see the source code on the screen of a conventional personal
computer just as would be the case in the debugging of software on
a desktop computer. A separate, frequently used approach is to run
software on a PC that emulates the physical chip in software, thus
making it possible to debug the performance of the software as if
it were running on an actual, physical chip.
Broadly speaking, embedded systems have received more attention to
testing and debugging because a great number of devices using
embedded controls are designed for use in situations where safety
and reliability are top priorities.
The internet of things builds on an embedded systems base
While some embedded systems can be relatively simple, a growing
number either supplant human decision-making or offer capabilities
beyond what a human could provide. For instance, some aviation
systems, including those used in drones , are able to
integrate sensor data and act upon that information
faster than a human could, permitting new kinds of operating
features.
The embedded system is expected to continue rapidly growing, driven
in large part by the internet of things (IoT). Expanding IoT
applications such as wearables, drones, smart homes ,
smart buildings, video surveillance, 3D printers and
smart transportation are expected to add to fuel embedded system
growth.
Open Handset Alliance and Android:
The Open Handset Alliance (OHA) is a business alliance that was
created for the purpose of developing open mobile device standards.
The OHA has approximately 80 member companies, including HTC, Dell,
Intel, Motorola, Qualcomm and Google. The OHA's main product is the
Android platform - the world's most popular smartphone
platform.
OHA members are primarily mobile operators, handset manufacturers,
software development firms, semiconductor companies and
commercialization companies. Members share a commitment to
expanding the commercial viability of open platform development.
OHA member companies back the open platform concept for a number of
reasons, as follows:
· Lower overall handset costs: Opens up resources, which
facilitates the focus on creating innovative applications,
solutions and services.
· Developer-friendly environment: In the open-source community,
developers share notes to expedite application development.
· Post-development: Provides an ideal channel for application
marketing and distribution.
Introduction to Android:
Android is a Linux based operating system it is designed primarily
for touch screen mobile devices such as smart phones and tablet
computers. The operating system have developed a lot in last 15
years starting from black and white phones to recent smart phones
or mini computers. One of the most widely used mobile
OS these days is android. The android is software
that was founded in Palo Alto of California in 2003.
The android is a powerful operating system and it supports large
number of applications in Smartphones. These applications are more
comfortable and advanced for the users. The hardware that supports
android software is based on ARM architecture platform. The android
is an open source operating system means that it’s free and any one
can use it. The android has got millions of apps available that can
help you managing your life one or other way and it is available
low cost in market at that reasons android is very popular.
Android Architecture:
Linux kernel:
The android uses the powerful Linux kernel and it supports wide
range of hardware drivers. The kernel is the heart of the operating
system that manages input and output requests from software. This
provides basic system functionalities like process management,
memory management, device management like camera, keypad, display
etc the kernel handles all the things. The Linux is really good at
networking and it is not necessary to interface it to the
peripheral hardware. The kernel itself does not interact directly
with the user but rather interacts with the shell and other
programs as well as with the hard ware devices on the system.
Libraries:
The on top of a Linux kennel there is a set of libraries including
open source web browser such as webkit, library libc. These
libraries are used to play and record audio and video. The SQLite
is a data base which is useful for storage and sharing of
application data. The SSL libraries are responsible for internet
security etc.
Android Runtime:
X
The android runtime provides a key component called Dalvik Virtual
Machine which is a kind of java virtual machine. It is specially
designed and optimized for android. The Dalvik VM is the process
virtual machine in the android operating system. It is a software
that runs apps on android devices.
The Dalvik VM makes use of Linux core features like memory
management and multithreading which is in a java language. The
Dalvik VM enables every android application to run it own process.
The Dalvik VM executes the files in the .dex format.
Application frame work:
The application frame work layer provides many higher level
services to applications such as windows manager, view system,
package manager, resource manager etc. The application developers
are allowed to make use of these services in their
application.
Applications and Features:
You will find all the android applications at the top
layer and you will write your application and install on this
layer. Example of such applications are contacts, books, browsers,
services etc. Each application perform a different role in the over
all applications.
Features:
· Connectivity: GSM/EDGE, IDEN, CDMA, Bluetooth, WI-FI,
EDGE,3G,NFC, LTE,GPS.
· Messaging: SMS, MMS, C2DM (could to device messaging), GCM
(Google could messaging)
· Multilanguage support
· Multi touch
· Video calling
· Screen capture
· External storage
Downloading and installing eclipse:
The list of software required to setup android for
eclipse IDE manually.
1. Install the JDK
2. Download and install the Eclipse for developing android
application
3. Download and Install the android SDK
4. Intall the ADT plugin for eclipse
5. Configure the ADT plugin
6. Create the AVD
1. Start Android Studio.
2. To open SDK Manager, do any of the these:
On Android Studio landing page, select Configure
> SDK Manager. ...
3. In the Default Settings dialog box, click these tabs
to install Android SDKplatform packages
and developer tools. SDK Platforms: Select the
latest Android SDK package. ...
4. Click Apply.
5. Click OK.
Exploring the Android SDK
Both tools are accessible through the graphical interface of
Google's own Android development environment, Android Studio,
as shown in Figure 1 or through the command line. If you are not
familiar with it, you can check out the reference section at the
end of this article or our previous tutorial, " Using Android
Studio ". The goal of this tutorial is to at least point out the
most common usage popular among developers and explain some
different options.
Figure 1: Tools on Android Studio
Managing Packages from the SDK Manager
You can start SDK Manager from Android Studio's menu by
choosing "Tools -> Android -> SDK Manager" or by clicking the
toolbar icon. You should see the main dialog, as shown in Figure 2.
The first thing you can verify is whether the SDK location is
indeed correct. In my case, it is under "C:\android-root\sdk\" as
shown. There are three tabs below that allow you to choose your
installation options from Platforms, Tools, or Update Sites.
Furthermore, there is a checkbox for "Show Package Details" on the
lower right corner; I strongly recommend that you enable it as
well. That way, you clearly can see what packages are actually
installed on the machine.
Some of the system images take up several gigabytes of your storage
space, but you probably will never have a need to use some of them.
For example, you perhaps will not do apps for TV or smart watches,
so you can feel free to uncheck those system images. And, if you
are specific about apps targeting at specific CPU types—for example
ARM—you can remove those Intel 32-bit or 64-bit system images. If
you plan to work only on apps for the most recent devices with
newer API levels, say Android 7.0 Nougat or later, any APIs before
that version can be unchecked. Checkboxes on the items can be used
to install, uninstall, or update. Once you confirm your selections
and click the "Apply" button, the component installer will start as
in Figure 3, responding to your request.
Figure 2: SDK Manager
Using SDK Manager from the Command Line
Although it is convenient and simple enough to interact with
the SDK Manager through a graphical interface, we still
sometimes need to accomplish similar goals in a programmatic mode;
for example, keeping a target platform up to date for a specific
device in a fully-automated setup. To locate the executable, we
first go to the Android SDK installed root folder. In my case, it
is at "c:\android-root\sdk\". From there, continue to look under
the subfolder "tools\bin\". We can test the command "sdkmanager
--list" to take an inventory of what packages are currently
installed on the machine and what are available from the remote
server, as in Figure 4. To install available packages, you specify
the quoted names separated by spaces and provide each of their
folder names separated by semicolons, as in the following code
example. It tries to install the platforms for both API levels 21
and 24. Similarly, the "--uninstall" and "--update" options follow
the same rules.
sdkmanager "platforms;android-21" "platforms;android-24"
What is the Android SDK:
The Android SDK (software development kit) is a set of development
tools used to develop applications for Android platform. The
Android SDK includes the following:
· Required libraries
· Sample source code
· Tutorials for the Android OS
· Every time Google releases a new version of Android, a
corresponding SDK is also released. To be able to write programs
with the latest features, developers must download and install each
version’s SDK for the particular phone.
· The development platforms that are compatible with SDK include
operating systems like Windows (XP or later), Linux (any recent
Linux distribution) and Mac OS X (10.4.9 or later). The components
of Android SDK can be downloaded separately. Third party add-ons
are also available for download.
· Although the SDK can be used to write Android programs in the
command prompt, the most common method is by using an integrated
development environment (IDE). The recommended IDE is Eclipse with
the Android Development Tools (ADT) plug-in. However, other IDEs,
such as NetBeans or IntelliJ, will also work. Most of these IDEs
provide a graphical interface enabling developers to perform
development tasks faster. Since Android applications are written in
Java code, a user should have the Java Development Kit (JDK)
installed.
Overview of Android Lifecycles:
A general overview of the lifecycle of an application is shown in
the following figure, which is taken from the documentation
for Activity .
Application : Hello world
Creating your first Android
The first step is to create a simple Android Application using
Android studio. When you click on Android studio icon, it will show
screen as shown below
You can start your application development by calling start a new
android studio project. in a new installation frame should ask
Application name, package information and location of the
project.−
After entered application name, it going to be called select the
form factors your application runs on, here need to specify Minimum
SDK, in our tutorial, I have declared as API23: Android
6.0(Mashmallow) −
The next level of installation should contain selecting the
activity to mobile, it specifies the default layout for
Applications.
At the final stage it going to be open development tool to write
the application code.
Anatomy of Android Application
Before you run your app, you should be aware of a few directories
and files in the Android project −
The Main Activity File
The main activity code is a Java file MainActivity.java. This
is the actual application file which ultimately gets converted to a
Dalvik executable and runs your application. Following is the
default code generated by the application wizard for Hello
World! application −
package com.example.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
@Override
}
}
Here, R.layout.activity_main refers to
the activity_main.xml file located in
the res/layout folder. The onCreate() method is
one of many methods that are figured when an activity is
loaded.
The Manifest File
Whatever component you develop as a part of your application, you
must declare all its components in a manifest.xml which
resides at the root of the application project directory. This file
works as an interface between Android OS and your application, so
if you do not declare your component in this file, then it will not
be considered by the OS. For example, a default manifest file will
look like as following file −
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
Here <application>...</application> tags enclosed the
components related to the application.
Attribute android:icon will point to the application icon
available under res/drawable-hdpi. The application uses the
image named ic_launcher.png located in the drawable folders
The <activity> tag is used to specify an activity
and android:name attribute specifies the fully qualified
class name of the Activity subclass and
the android:label attributes specifies a string to use as
the label for the activity. You can specify multiple activities
using <activity> tags.
The action for the intent filter is
named android.intent.action.MAIN to indicate that this
activity serves as the entry point for the application.
The categoryfor the intent-filter is
named android.intent.category.LAUNCHER to indicate that
the application can be launched from the device's launcher
icon.
The @string refers to the strings.xml file
explained below. Hence, @string/app_name refers to
the app_name string defined in the strings.xml file,
which is "HelloWorld". Similar way, other strings get populated in
the application.
Following is the list of tags which you will use in your manifest
file to specify different Android application components −
· <activity>elements for activities
· <service> elements for services
The Strings File
The strings.xml file is located in
the res/values folder and it contains all the text that
your application uses. For example, the names of buttons, labels,
default text, and similar types of strings go into this file. This
file is responsible for their textual content. For example, a
default strings file will look like as following file −
<resources>
</resources>
The Layout File
The activity_main.xml is a layout file available
in res/layout directory, that is referenced by your
application when building its interface. You will modify this file
very frequently to change the layout of your application. For your
"Hello World!" application, this file will have following content
related to default layout −
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
</RelativeLayout>
This is an example of simple RelativeLayout which we will
study in a separate chapter. The TextView is an Android
control used to build the GUI and it have various attributes
like android:layout_width, android:layout_height etc
which are being used to set its width and height etc..
The @string refers to the strings.xml file located in the
res/values folder. Hence, @string/hello_world refers to the hello
string defined in the strings.xml file, which is "Hello
World!".
Running the Application
Let's try to run our Hello World! application we just
created. I assume you had created your AVD while doing
environment set-up. To run the app from Android studio, open one of
your project's activity files and click Run