technical report - web viewabstract. google android, google’s new product and its first...
TRANSCRIPT
ABSTRACTGoogle Android, Google’s new product and its first attempt to enter the mobile market,
might have an equal impact on mobile users like Apple’s hyped product, the iPhone. In this
Technical report I am going to present the Google Android platform, what is Android. A
simple Hello Android Application has been studied to show you how easier it is to develop
applications for this platform. This report is basically a recommendation report for all the
students who have studied Java that they should study Andriod Programming as well because
it is easy to understand and you don’t even need any physical device to test our applications.
But, of course, if you are working on Bluetooth then obviously you cannot test it without any
real phone.
ii
TABLE OF CONTENTS
ABSTRACT
TABLE OF CONTENTS
LIST OF FIGURES
ACKNOWLEDGEMENTS
CHAPTER#1: INTRODUCTION1.1 Features & Specifications1.2 Google Android Architecture1.3 Versions Of Android1.4 Android SDK
1.5 Android Documentation1.5.1 SDK Documentation1.5.2 Online Resources
CHAPTER#2: DEVELOPING ANDROID APPLICATIONS2.1 Installing Java2.2 Installing Eclipse2.3 Downloading The SDK Starter Package2.4 Installing The ADT Plugin For Eclipse2.5 Creating Your First Program2.5.1 Running On The Emulator2.5.2 Creating An AVD2.5.3 Running On A Real Phone2.6 False Assumptions For Android Programming2.6.1 You Should Know Java Perfectly2.6.2 You Should Know Your Ide (Eclipse Or Netbeans) Perfectly2.6.3 You Need To Have An Android Based Phone
APPENDIX#1: MOBILE OPERATING SYSTEMS
iii
APPENDIX#2: COMPANIES SUPPORTING ANDROID
APPENDIX#3: TOOLS WITHIN ANDROID SDK
RECOMMENDATIONS
REFERENCES
iv
LIST OF FIGURESFigure 1.1: The Google Android Architecture overview
Figure 1.2: Versions of Android
Figure 2.1: New Android Project
Figure 2.2: Creating an AVD
Figure 2.3: Running Program on Emulator
Figure A1.1: Mobile Operating System
Figure A1.2: Market Share of Mobile OS
v
ACKNOWLEDGEMENTS
I would like to thank all those people who supported me and have made this report possible.
Further more I would like to thank Donn Felker. Without his explanations on this subject I
would never have been motivated to study Android Programming and write a
recommendation report for my class fellows. I would also like to thank Miss Narmeen
Shawoo Bawani who had taught us Java this semester.
vi
Chapter#1: INTRODUCTION
Chapter#1: INTRODUCTIONOperating Systems have developed a lot in last 15 years. Starting from black and white
phones to recent smart phones or mini computers, mobile OS has come far away.
Especially for smart phones, Mobile OS has greatly evolved from Palm OS in 1996 to
Windows pocket PC in 2000 then to Blackberry OS and Android.
One of the most widely used mobile OS these days is Android. Android comprises not
only operating system but also middleware and key applications. Android Inc was
founded in Palo Alto of California, U.S. by Andy Rubin, Rich miner, Nick sears and
Chris White in 2003. Later Android Inc. was acquired by Google in 2005.
Google Android, a Linux-kernel-based operating system, comes along with a quite new
credo within this market: it is supposed to be open! This, in particular, means all elements
used shall be provided in source code form so that developers will have the possibility to
take a closer look into the system to maybe alter it to their needs. In order to guarantee a
great impact of Google Android on the market, Google organized several developer
contests in order to create a rich set of ready-to-go applications for the Android platform
before the actual phone got available on the market, hoping to enter the competition with
Apple’s iPhone market. As strategic partners Google picked HTC as provider for the first
physical device running Android and T-Mobile as telephone provider.
See appendices for mobile operating systems and list of companies that support Android
in their hardware.
1.1 FEATURES AND SPECIFICATIONS
Android is a powerful Operating System supporting a large number of applications in
Smart Phones. These applications make life more comfortable and advanced for the
users. Taking a closer look at the operating system, we are dealing with an ARM-
architecture based system (armv5tejl) which is quite common for small or handheld
1
Chapter#1: INTRODUCTION
devices. The provided 2.6 kernel (2.6.25-00350-g40fff9a in SDK version 1.0_r1) is
slightly modified - specialized for handheld devices - and offers support for the most
commonly used hardware devices in the embedded field of use (SD-Card, USB, and
more)[1]. Some of the current features and specifications of android are:
a) Application framework
b) Dalvik Virtual machine
c) Integrated Browser
d) Optimized graphics
e) SQLite
f) Media Support
g) GSM Technology
h) Bluetooth, EDGE, 3G, Wi-fi
i) Camera, GPS, Compass etc
1.2 GOOGLE ANDROID ARCHITECTURE
The architecture basically consists of four sections: the Linux kernel (system) as
underlying operating system interface, the libraries as important part of the operating
system; the Android framework providing all necessary classes and methods in order to
write Android compatible applications; and, as top section, the actual Android
applications[2].
2
Chapter#1: INTRODUCTION
Figure 1.1: The Google Android Architecture overview[2]
1.3 VERSIONS OF ANDROID
After original release there have been number of updates in the original version of
Android[1].
3
Chapter#1: INTRODUCTION
Figure 1.2: Versions of Android[1]
1.4 ANDROID SDKAs no officially obtainable physical device is available at time of writing, developers will
have to rely on the provided development kit: Google Android SDK. A core element of
the SDK is the actual Google Android Emulator which provides a graphical emulation of
a possible handheld device running Google Android. Further-more, the SDK not only
provides the core classes of the Android framework packed into a Java Jar-file: it also
4
Chapter#1: INTRODUCTION
includes the documentation in HTML-form and several tools that improve the usability
and interaction with the emulator.
Once the SDK has been downloaded, developers can directly start creating Android-
applications, compiling them and deploying them to the emulator. Nothing more than an
editor and a working JDK (Sun JDK) is required.For this, Google optionally provides an
Android Plugin made for Eclipse that will take over a few basic tasks like creating the
Android Project layout on disk, the integration of your SDK, eventually starting your
emulator if not running yet and the deployment of you application on the emulator.Once
the SDK-archive is unpacked on the host system, a quick glance at the file system
structure reveals the tools directory is, by far, the most interesting directory to inspect: in
its root directory it offers several executables consisting of shell scripts, binaries, python
scripts, basically everything that enables the developer to create Android projects and
work with them. Furthermore, the tools/lib directory contains several Java-libraries in
form of Jar-files. And, last but not least, the tools/lib/images directory accommodates the
emulator base images which are loaded upon emulator start.
All important tools for successfully developing applications for the Android platform can
be found in the tools directory. If the developer uses Eclipse as standard development
IDE, he will most likely not be confronted with any of these: the optionally available
Eclipse plugin provided on the Google Android project website takes over the
responsibility for all necessary tasks. One can simply concentrate on writing the code, a
simple click on the build button will automatically do the rest.In case, you are not using
any IDE or simply not using the plugin, see appendix#3 for a short overview of each tool
and its meaning [1].
1.5 ANDROID DOCUMENTATION
No development without appropriate documentation. Google is aware of this and offers
two valuable sets of information resources [1].
5
Chapter#1: INTRODUCTION
1.5.1 SDK DOCUMENTATION
Each SDK includes an offline documentation set including the Android Java API
and code examples for most basic issues when developing for Android. The
documentation can be easily observed with any given browser [1].
1.5.2 ONLINE RESOURCES
Google offers an easy to understand API, enriched with various code examples,
guidelines for naming conventions, extensive descriptions to all parts of the
Android platform on the project website [1].
6
Chapter#2: DEVELOPING ANDROID APPLICATIONS
Chapter#2: DEVELOPING ANDROID APPLICATIONSLuckily, getting started developing with Android is easy. You don’t even need access to
an Android phone, just a computer where you can install the Android SDK and phone
emulator. The Android software development kit (SDK) works on Windows, Linux, and
Mac OS. The applications you create, of course, can be deployed on any Android
devices. Before you start coding, you need to install Java, an IDE, and the Android SDK.
2.1 INSTALLING JAVA
Android applications are written in java-not the full blown Java that J2EE developers are
used to, but a subset of Java that is sometimes known as the Dalvik Virtual Machine. This
smaller subset of Java excludes classes that don’t make sense for mobile devices.
It’s not enough to just have a runtime environment (JRE); you need the full development
kit. It is recommended to get the latest Sun JDK update from the Sun download site.
2.2 INSTALLING ECLIPSE
Next, you should install a Java development environment if you don’t have one already. I
recommend Eclipse, because it’s free and because it’s used and supported by the Google
developers who created Android.
If you don’t want to use Eclipse (there’s always one in every crowd), support for other
IDEs such as NetBeans and JetBrains IDEA is available from their respective
communities. Or if you’re really old-school, you can forgo an IDE entirely and just use
the command-line tools.
7
Chapter#2: DEVELOPING ANDROID APPLICATIONS
The minimum version of Eclipse is 3.3.1, but you should always use whatever is the most
up-to-date production version. Note that you need more than just the standard Eclipse
SDK “classic” platform. Go to the Eclipse downloads page, and pick “Eclipse IDE for
Java Developers.” Follow the directions there for downloading, unpacking, and installing
Eclipse into a suitable location (like C:\Eclipse on Windows).
2.3 DOWNLOADING THE SDK STARTER PACKAGE
The SDK starter package is not a full development environment—it includes only the
core SDK Tools, which you can use to download the rest of the SDK components (such
as the latest Android platform).If you haven't already, get the latest version of the SDK
starter package from the SDK download page.
If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a
safe location on your machine. By default, the SDK files are unpacked into a directory
named android-sdk-<machine-platform>.
If you downloaded the Windows installer (.exe file), run it now and it will check whether
the proper Java SE Development Kit (JDK) is installed (installing it, if necessary), then
install the SDK Tools into a default location (which you can modify).
Make a note of the name and location of the SDK directory on your system—you will
need to refer to the SDK directory later, when setting up the ADT plugin and when using
the SDK tools from the command line.
2.4 INSTALLING THE ADT PLUGIN FOR ECLIPSE
Android offers a custom plugin for the Eclipse IDE, called Android Development
Tools(ADT) that is designed to give you a powerful, integrated environment in which to
8
Chapter#2: DEVELOPING ANDROID APPLICATIONS
build Android applications. It extends the capabilities of Eclipse to let you quickly set up
new Android projects, create an application UI, debug your applications using the
Android SDK tools, and even export signed (or unsigned) APKs in order to distribute
your application. In general, developing in Eclipse with ADT is a highly recommended
approach and is the fastest way to get started with Android.
If you'd like to use ADT for developing Android applications, install it now. Follow these
steps to download the ADT plugin and install it in your Eclipse environment.
a) Start Eclipse, then select Help > Install New Software....
b) Click Add, in the top-right corner.
c) In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and
the following URL for the Location:
https://dl-ssl.google.com/android/eclipse/
d) Click OK
Note: If you have trouble acquiring the plugin, try using "http" in the Location
URL, instead of "https" (https is preferred for security reasons).
e) In the Available Software dialog, select the checkbox next to Developer Tools
and click Next.
f) In the next window, you'll see a list of the tools to be downloaded. Click Next.
g) Read and accept the license agreements, then click Finish.
Note: If you get a security warning saying that the authenticity or validity of the
software can't be established, click OK.
h) When the installation completes, restart Eclipse.
If you prefer to work in a different IDE, you do not need to install Eclipse or ADT.
Instead, you can directly use the SDK tools to build and debug your application [3].
9
Chapter#2: DEVELOPING ANDROID APPLICATIONS
2.5 CREATING YOUR FIRST PROGRAM
ADT comes with a built-in example program, or template, that we’re going to use to
create a simple “Hello, Android” program in just a few seconds. Select File > New >
Project... to open the New Project dialog box. Then select Android > Android Project,
and click Next.
Enter the following information:
Project name: HelloAndroid
Build Target: Android 1.6
Application name: Hello, Android
Package name: org.example.hello
Create Activity: Hello
When you’re done, it should look something like Figure 2.1. Click Finish. The Android
plug-in will create the project and fill it in with some default files. Eclipse will build it
and package it up so it will be ready to execute. If you get an error about missing source
folders, select Project > Clean to fix it. First we’ll run the program under the Android
Emulator [2].
10
Chapter#2: DEVELOPING ANDROID APPLICATIONS
Figure 2.1: New Android Project
2.5.1 RUNNING ON THE EMULATOR
To run your Android program, go to the Package Explorer window, right-click the
HelloAndroid project, and select Run As > Android Application. If you’re
following along in Eclipse you may see an error dialog like the one in. This
indicates we haven’t told the Emulator what kind of phone to emulate.
11
Chapter#2: DEVELOPING ANDROID APPLICATIONS
2.5.2 CREATING AN AVD
To do this, you need to create an Android Virtual Device (AVD), using either
Eclipse or the android avd command.6 It’s easier to use Eclipse, so select Yes in
the AVD Error dialog to open the AVD Manager. You can open the manager
again later by selecting Window > Android AVD Manager.
In the AVD Manager dialog, fill out the fields for the new AVD as follows:
Name: em16
Target: Android 1.6 - API Level 4
SDCard: 128M
Skin: Default (HVGA)
Figure 2.2: Creating an AVD
12
Chapter#2: DEVELOPING ANDROID APPLICATIONS
This tells Eclipse to set up a generic device called “em16,” which has the Android
1.6 (Donut) firmware installed. A 128MB virtual Secure Digital (SD) Card will be
allocated, along with a half-VGA (320×480) display. Due to updates in the plug-
in since this was written your screen may look slightly different. Click Create
AVD to create the virtual device. A few seconds later you should see a message
that the device has been created. Click OK, and then select the AVD and click
Start... to bring it up. Close the AVD Manager window when you’re done.
Once you have a valid AVD, the Android emulator window will start up and boot
the Android operating system. The first time you do this, it may take a minute or
two, so be patient. You may need to right-click on the project and select Run As >
Android Application again. If you see an error message saying that the application
is not responding, select the option to continue waiting.
Eclipse will send a copy of your program over to the emulator to execute. The
application screen comes up, and your “Hello, Android” program is now running.
That’s it! Congratulations on your first Android program [2].
Figure 2.3: Running Program on Emulator
13
Chapter#2: DEVELOPING ANDROID APPLICATIONS
2.5.3 RUNNING ON A REAL PHONE
Running an Android program on a physical device such as the T-Mobile G1
during development is almost identical to running it on the emulator. All you need
to do is connect your phone to the computer with a USB cable and install a special
device driver [2].
2.6 FALSE ASSUMPTIONS FOR ANDROID PROGRAMMING
There is no hard and fast rule for programming android applications. If you know basic
of Java, you have an IDE and you want to program android applications then that’s all
you need.
2.6.1 YOU SHOULD KNOW JAVA PERFECTLY
Most of very serious experts would say “You have to know Java language perfectly
or you can not even dream about Android development!” That is not so true. If you
know the basics then that is all you need!
2.6.2 YOU SHOULD KNOW ECLIPSE OR NETBEANS PERFECTLY
Another thing that expert would say “You need to know your IDE perfectly or you
will be lost in it before learning a new language!” The truth is you just need to start
using an IDE to learn it.
14
Chapter#2: DEVELOPING ANDROID APPLICATIONS
2.6.3 YOU NEED TO HAVE AN ANDROID BASED PHONE
It is good to have and Android phone. it would be best to have a few phones with
different Android versions and different add-ons (Android tablet may be useful too)
to test if your app is working with all of them! But it still won’t help you to get rid
of all problems that an app may cause on another device. It is helpful to test your
app with real touch screen but for most cases an Android phone emulator (that is
included in Android SDK) is really enough. [4]
15
Appendix#1: MOBILE OPERATING SYSTEMS
Appendix#1:
MOBILE OPERATING SYSTEMSThere are different other Mobile operating systems also present in market in competition
with Android. Apple's iOS and Windows Phone give strong competition to Android. A
simple comparison between features and specifications of latest version of Android and other
Operating Systems can be seen in the table given below.
Figure A1.1: Mobile Operating System
According to Canalys, In Q2 2009 Android had 2.8% market share which had grown to 33%
market share by Q4 2010 which made Android leader of smart phone OSs worldwide. The
market share for commonly used mobile OSs is shown in the following pie chart[1].
Figure A1.2: Market Share of Mobile OS
16
Appendix#2:Companies Supporting Android
Appendix#2:
COMPANIES SUPPORTING ANDROID
A list of companies supporting Android in their hardware is[1]:
a) Acer Inc
b) ALCATEL ( TCL corporation )
c) Bluelans Communications
d) NCE casio Mobile Communications
e) Cherry Mobile
f) CSL
g) Dell
h) Garmin
i) Geeks Phone
j) General Mobile
k) High screen
l) HKC
m) HTC coroporation
n) Huawei
o) I-mobile
p) Lenovo
q) LG
r) Motorola
s) Samsung
t) Sony Ericsson
u) Videocon
v) ZTE
17
Appendix#2:Companies Supporting Android
Appendix#3:
TOOLS WITHIN ANDROID SDKIn case, you are not using any IDE or simply not using the plugin, following will give a short
overview of each tool and its meaning [5]:
AAPT: Android Asset Packaging Tool enables the developer to view, create and update Zip-
compatible archives. It can also compile resources into binary assets.
activityCreator: The shell script is used to create basic file system structure for a new
Android project. From then on, any IDE or Editor can be used to alter the code.
ADB: Android Debug Bridge is a very powerful service basically enables all communication
to and from the emulator. Connecting with the emulator via port 5555, it enables the user to
execute remote shell commands or simply provides a login shell.
AIDL: The Android Interface Definition Language tool is used to generate code that enables
two processes on an Android-powered device to communicate with each other using IPC.
DDMS: Dalvik Debug Monitor Service. This tool provides port-forwarding ser-vices, screen
capturing on the device, thread and heap information, log cat and much more.
DMTraceDump: Alternative to generate graphical call-stack diagrams from trace log files.
DX: Generates bytecode from .class files. It converts the files into the .dex file format which
can be run in the Android environment.
MKSDCard:Creates a FAT32 disk image which can be loaded upon emulator start. Sim-
ulate the presence of an SD card.
18
Appendix#2:Companies Supporting Android
SQLite:The well-know SQLite database which saves its databases in plain files. It can be
used for debugging issues (inspecting databases in Android).
TraceView: Traceview is used to view trace files which can be created on the device.
Emulator: Executable to start the Android Emulator.
19
RECOMMENDATIONSMore than 500,000 new Android devices were being activated daily, and the number was
growing at 4.4 percent week over week, Google's (Nasdaq: GOOG) Andy Rubin tweeted in
late June. comScore's figures show that for the three-month period ending in May, Android
was the leading mobile platform in the United States, with 38 percent of the market. It's on
the fast track to be the most expensive free product ever created. Android is the leading
smartphone OS in the US now and it powers more than 130 million devices across the world
including a phalanx of cheap handsets across Asia. Android is a killer app from Google. The
future of Android developers is looking very bright and there is a lot of space for new
applications ideas. Android provides access to a wide range of useful libraries and tools that
can be used to build rich applications. For example, Android enables developers to obtain the
location of the device, and allows devices to communicate with one another enabling rich
peer-to-peer social applications. In addition, Android includes a full set of tools that have
been built from the ground up alongside the platform providing developers with high
productivity and deep insight into their applications. [5]
There are a few things you need to start a real Android development. Here are the points that
in my honest opinion are really required:
a) Basic Java knowledge (or any other object oriented language)
b) Free to download Android SDK with included Android phone emulator
c) Free IDE like Eclipse
d) Free Android documentation
Other things that are not necessary but are very helpful (in my case):
a) Android phone
b) Good Android book to get to know the basics (“Hello, Android” and “Beginning
Android 2“)
So if you really want to be an Android developer – don’t be scared by the “experts” – just try
to learn it and you will be surprised how easy it may be!
20
REFERENCES1. Introduction
http://www.engineersgarage.com/articles/what-is-android-introduction
2. Android Application Development for Dummies 2011
Author: Donn Felker
3. Installation processes
developer.android.com/
4. Foolish Assumptions for Android Programming
http://www.kreci.net/android/is-it-hard-to-become-an-android-developer/
5. Tools within Android SDK
Technical Report: TUB-DAI 03/09-01 by Hans-Gunther Schmidt, Karsten Raddatz,
Aubrey-Derrick Schmidt, Ahmet Camtepe, and Sahin Albayrak
6. Fast & easy application development
http://www.android.com/about/
21