Vous êtes sur la page 1sur 16

1.

INTRODUCTION

A2I Private Limited is a premier organization founded in 1998, growing as an IT Training/service


providers and determined to set high standards in IT industry. Initially started as an IT training institute,
the institute has now expanded to include software development as well as IT Consultant Services.
Currently the institute, operate as three strategic business units focusing on IT Training, IT
Development, and IT Solutions.
The mission of the A2I Private Limited is to provide its students with the foundation for lifelong
learning. Whether they choose to continue their education or enter the workforce, SCA students are
trained to succeed. Here, at Bhopal, we believe in creating a dynamic learning environment, both inside
and outside of the classroom.
Whether students need help within individual courses or are simply looking to expand their horizons
through a variety of educational activities, we provide the resources to enable our students success.

Mentoring and tutoring services


Confidential counseling services
Workshops on resume writing and interviewing techniques
Career Services assistance after graduation
Refresher courses for alumni to keep them up to speed

Android is most popular mobile platform in other word it is mobile Operating system which can
provide multi-function operation in mobile and with the help of android working is fast. It is Linux
based operating system generally design for touchscreen mobile.
Android is an operating system. This OS is the most popular OS found in mobile devices like,
smartphones, tablets, fitness gadgets, etc. The advantages of Android are:
Multitasking Yups, Android phones can run many applications, it means you can browse,
Facebook while listened to the song.
Ease of Notification Any SMS, Email, or even the latest articles from an RSS Reader, there
will always be a notification on the Home Screen Android phone, do not miss the LED
indicator is blinking, so you will not miss a single SMS, Email or even Misscall .
Easy access to thousands of applications via the Google Android Android App Market
When you love to install applications or games, through Googles Android App Market,
Agan can download applications for free. There are many thousands of applications and
games that are ready for download on Android phones You.
Phone options are diverse Talk Android phone, it will feel different than the IOS, if the
IOS is limited to the iPhone from Apple, then Android is available on mobile phones from
various manufacturers, from Sony Ericsson, Motorola, HTC to Samsung. And each handset
manufacturer also presents an Android phone in the style of each, such as Motorola with its
Motoblur, Sony Ericsson with its Timescape. So You can freely choose the Android phone in
accordance with the brand favorite.
Can install a modified ROM not satisfied with the standard view of Android, do not worry
there are many custom ROM that can be used in your mobile phones Android .
Widget absolutely right, with the widgets on the homescreen, You can easily access a
variety of settings quickly and easily.

Google Maniac If you are a loyal user of Google services ranging from Gmail to Google
Reader Android phone has integrated with Google services, so you can quickly check e-mail
from Gmail.
The reasons for the growing popularity of android are:
Open-Source Platform: As android is an open source platform, the developers can able to get
more chances of developing new and inventive android applications. Also, the platform is
more affordable for the developers who build the applications and for the customers who use
the applications.
Developer-friendly: Android provides a Software development kit (SDK), which consists of
uncomplicated tools for developers to develop their projects easily. The SDK offers an ease
of developing Android applications and hence helps developers to transform their ideas into
android applications. Thus, it provides a great experience for developers when they develop
android applications.
Ample opportunities: Due to this invariable growth and popularity of android applications,
the developers in various IT organizations get more opportunities to get associated with
android.
Ample options for tools: Android proffers sundry options for developers to use various tools
for the development process. If developers need some extra tools for their development
process, the android allows them to exploit third-party tools effectively.
Popularity of Android Apps: Nowadays, people are moving towards the android because of
the increasing popularity of Smartphones. Hence, the developers have started concentrating
more on the android application development. When compared to other operating systems,
the android based smartphones are more user-friendly and constructive.
Various security options: The major reason for the popularity of android is that the security
options obtainable by android applications for Smartphones. The Orbot application on
android allows users to perform instant messaging, access internet and access emails without
being scrutinized and blocked by the provider of mobile internet services.
Vast availability: Unlike the iPhone and Blackberry, Android phones proffer varied
availability options to other companies who develop mobile applications. Because of this
reason, different variety of Android devices have drastically increased in recent times.
Better Performance: As android is supposed to be a Linux-based operating system, it
provides smooth operation and advanced performance stability without having the panic of
crashes.
Supports flash: The newest android version gives great support to flash. Therefore, the
Android users get the similar experience of using desktops on their mobile phones. By using
Android phones, people enjoy playing graphic games and other entertainment stuffs.
Saves Money: As android is an open source platform, it allows developers to develop
applications at very low-cost. Also, the time that is taken during the development process is
considerably reduced in android. Therefore, Android helps developers to save both time and
money.
Application Store: The android application store facilitates users to analysis, exploit and
download a large variety of android applications. Almost all applications are freely available
for users whereas some carries price tags. According to the survey, around 7 lakhs
applications are at present available in the Android application store and estimated over 25
billion applications have been downloaded.

Due to these advantages android is quite famous in mobile market. As we can see that android has its
own app store through which users can download apps for their phone. This same app store can be used
to publish the apps developed by the developers. Google provides an android software development kit
(android sdk) for developers to develop applications anywhere around the world. This advantage given
by Google for android users and android app developers is one of the major reasons for the success of
android. The applications uploaded by the developers is first approved by Google and then made
available for the users to download. This feature of having so many developers around the world is not
found in ios or blackberry os.
During my training period I was assigned a computer loaded with the android sdk which included
eclipse (with an android plugin) and a virtual android device with different versions of Android. This
software was used for the development of android application.

2. TRAINING
As per Google:
Android is a software stack for mobile devices that includes an operating system, middleware and
key applications.

Figure 1

History of Android

At Google, the team led by Rubin developed a mobile device platform powered by the Linux
kernel
In 2007, the Open Handset Alliance a consortium of several companies which included Google,
HTC, Intel, LG, Motorola, Samsung, T-Mobile, etc., was announced.
The goal of the Open Handset Alliance is to develop open standards for mobile devices.
In 2008, 14 new members joined, including Sony Ericsson, Toshiba Corp, and Vodafone
Group.
As of today OHA is group of 86 companies.

Versions of Android
Platform

CodeName

1.5

CupCake

1.6

Donut

2.1

clair

2.2

Froyo

2.3.0 2.3.7

GingerBread

3.0 3.2

HoneyComb

4.0 4.0.3

IceCreamSandwich

4.1 4.3

JellyBean

4.4 4.4.4

KitKat

5.0 (Current)

Lollipop

Android Architecture

Figure 2

The architectural diagram shows that the Android platform can be broken down into 4 sections:
Operating system
Middleware libraries
Application framework
Applications
Operating System:
At the very bottom of the Android stack is the operating system. Android's OS is Linux based
and performs tasks similar to a desktop computer OS. This includes:
1. Interfacing with the hardware through a set of device drivers (such as audio or video drivers)
2. Processing user input
3. Managing application processes, handling file and network I/O, and so forth
Middleware Libraries
The middleware includes libraries for many functions (data storage, graphics rendering, web
browsing, and so on) and it also contains a special sub-section called the Dalvik runtime.
This is Android's special non-standard JavaVirtual Machine (JVM) and its core Java application
libraries.

Application Framework
A framework, as we know is a set of basic tools which help a developer to build more complex tools.
The developers can access all framework APIs and manage phones basic functions like resource
allocation, switching between processes or programs, telephone applications, and keeping track of the
phones physical location.
Applications
There are 4 different types of applications available on most Android devices:
Core open source applications that are included as part of Android itself, such as the Browser,
Camera, Gallery, Music, Phone.
Proprietary Google apps that are not open source which are included with most official builds,
including: Market, Gmail, Maps, YouTube and more.
Handset manufacturer specific applications that is included on specific builds (such as AT&Ts
own music player, Verizon's own Navigator, or Sprint's TV).
Third party applications that are available in the Android Market.

Android Application Development Process

Android applications are primary written in the Java programming language.


The Java source files are converted to Java class files by the Java compiler.
Android provides a tool dx which converts Java class files into a dex (Dalvik Executable) file.
All class files of one application are placed in one compressed .dex file.

Figure 3

The .dex file and the resources of an Android project, e.g. the images and XML files are packed
into an .apk(Android Package) file.

The resulting .apk file contains all necessary data to run the Android application and can be
deployed to an Android device

Each student at the training center was provided a computer pre-loaded with android sdk. The basic
languages needed to develop applications for android are Java and XML. The XML language is used for
designing the app i.e. for its look and feel. Java language is used for providing the app with its
functionality. SQLite is used as the database for the application.
The development of android application is a short and sweet process with not much complication.
The UI is simply designed using XML which gives us no. of layouts and positions due to which the
positioning of the objects is managed itself according to the resolution of the screen.
Java being a widely known language, basically known for its simplicity and robustness gives the
android applications great functionality.
The basic steps for developing applications are shown in figure 1. The development steps encompass
four development phases, which include:

Setup: During this phase you install and set up your development environment. You also create
Android Virtual Devices (AVDs) and connect hardware devices on which you can install your
applications.

Figure 4

Development: During this phase you set up and develop your Android project, which contains all
of the source code and resource files for your application.

Figure 5

Debugging and Testing:


During this phase you build your project into a debuggable .apk
package that you can install and run on the emulator or an Android-powered device.
o If you are using Eclipse, builds are generated each time your project is saved.
o Next, you debug your application using a JDWP-compliant debugger along with the
debugging and logging tools that are provided with the Android SDK. Eclipse already
comes packaged with a compatible debugger.
o Last, you test your application using various Android SDK testing tools.
Publishing: During this phase you configure and build your application for release and
distribute your application to users.

Figure 6

Components of an Android App


There are various folders and files that make up an Android App. Following is their description:
a. src: Contains .java files.
b. Android<version>: Contains a file called android.jar which all the .jar files need for any
application
c. res: Contains all the resources. Two important files are main.xml (which handles the layout) and
strings.xml(which contains all the string constants)
d. gen: Contains the file R.java which contains the mapping for all the resources found in the
project. We should never modify it
e. bin: Contains .dex and .apk files
f. AndroidManifest.xml: It is the manifest file for our application and contains all the permissions
needed by our application like allowing the application to activate automatically as the phone
rings
g. assets: Contains all the assets needed by the application like text files , databases etc.

The DVM in Detail

Dalvik is Googles own JVM which is in charge of running java based Android apps
It has been optimized to run on mobile platforms
It has 3 main criteria
o It is fast, even on weak CPUs
o It runs on systems with little memory
o It runs in an energy-efficient way

JVM vs DVM
1. DVM cant interpret java bytecode
2. No multiple .class files are executed. Rather a single .dex file is generated by DVM for
execution
3. JVM is stack based while DVM is register based which results in fewer instruction dispatches
and smaller program size
Fewer instructions mean less CPU cycles and therefore less battery consumption. Smaller program size
means less memory consumed at runtime.

Major Android Elements


An Android application can have the following important components:
a. Activity: Represents the presentation layer of an Android application. A simplified description is
that an Activity is the screen which the user sees. An Android application can have several
activities and it can be switched between them during runtime of the application.
b. Views: Are user interface elements e.g. buttons or text fields. The base class for all Views is
android.view.View. They have attributes which can be used to change their appearance and
behaviour.
c. Services: Services perform background tasks without providing an UI. They can notify the user
via the notification framework in Android
d. Receivers: Allows us to code something that can be executed in response to change of the state
of the phone like as soon as the phone rings or internet connection is established
e. ContentProvider: Allows us to share the data of one application with the other. Like via
ContentProvider we can access the Contacts data
f. Intents: Allows us to call one Activity from the other as well as call other built in applications
like Browser , Phone etc from our application
a. Activity
An Activity is an application component that provides a screen with which users can interact in order
to do something, such as dial the phone, take a photo, send an email, or view a map. Each activity is
given a window in which to draw its user interface. The window typically fills the screen, but may be
smaller than the screen and float on top of other windows.
An application usually consists of multiple activities that are loosely bound to each other. Typically,
one activity in an application is specified as the "main" activity, which is presented to the user when
launching the application for the first time. Each activity can then start another activity in order to

perform different actions. Each time a new activity starts, the previous activity is stopped, but the system
preserves the activity in a stack (the "back stack").
b. View
This class represents the basic building block for user interface components. A View occupies a
rectangular area on the screen and is responsible for drawing and event handling. View is the base class
for widgets, which are used to create interactive UI components (buttons, text fields, etc.). The
ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views
(or other ViewGroups) and define their layout properties.
All of the views in a window are arranged in a single tree. You can add views either from code or by
specifying a tree of views in one or more XML layout files. There are many specialized subclasses of
views that act as controls or are capable of displaying text, images, or other content.
Once you have created a tree of views, there are typically a few types of common operations you
may wish to perform:

Set properties: for example setting the text of a TextView. The available properties and the
methods that set them will vary among the different subclasses of views. Note that properties that
are known at build time can be set in the XML layout files.
Set focus: The framework will handled moving focus in response to user input. To force focus to
a specific view, call requestFocus().
Set up listeners: Views allow clients to set listeners that will be notified when something
interesting happens to the view. For example, all views will let you set a listener to be notified
when the view gains or loses focus. You can register such a listener using
setOnFocusChangeListener(android.view.View.OnFocusChangeListener). Other view subclasses
offer more specialized listeners. For example, a Button exposes a listener to notify clients when
the button is clicked.
Set visibility: You can hide or show views using setVisibility(int).

c. Services
A Service is an application component that can perform long-running operations in the background
and does not provide a user interface. Another application component can start a service and it will
continue to run in the background even if the user switches to another application. Additionally, a
component can bind to a service to interact with it and even perform interprocess communication (IPC).
For example, a service might handle network transactions, play music, perform file I/O, or interact with
a content provider, all from the background.
A service can essentially take two forms:
Started: A service is "started" when an application component (such as an activity) starts it by
calling startService(). Once started, a service can run in the background indefinitely, even if the
component that started it is destroyed. Usually, a started service performs a single operation and
does not return a result to the caller. For example, it might download or upload a file over the
network. When the operation is done, the service should stop itself.
Bound: A service is "bound" when an application component binds to it by calling bindService().
A bound service offers a client-server interface that allows components to interact with the
service, send requests, get results, and even do so across processes with interprocess
communication (IPC). A bound service runs only as long as another application component is

bound to it. Multiple components can bind to the service at once, but when all of them unbind,
the service is destroyed.
Although this documentation generally discusses these two types of services separately, your service
can work both waysit can be started (to run indefinitely) and also allow binding. It's simply a matter
of whether you implement a couple callback methods: onStartCommand() to allow components to start
it and onBind() to allow binding.
Regardless of whether your application is started, bound, or both, any application component can use
the service (even from a separate application), in the same way that any component can use an activity
by starting it with an Intent. However, you can declare the service as private, in the manifest file, and
block access from other applications. This is discussed more in the section about Declaring the service in
the manifest.
d. Receivers
Base class for code that will receive intents sent by sendBroadcast().
If you don't need to send broadcasts across applications, consider using this class with
LocalBroadcastManager instead of the more general facilities described below. This will give you a
much more efficient implementation (no cross-process communication needed) and allow you to avoid
thinking about any security issues related to other applications being able to receive or send your
broadcasts.
You can either dynamically register an instance of this class with Context.registerReceiver() or
statically publish an implementation through the <receiver> tag in your AndroidManifest.xml.
Note: If registering a receiver in your Activity.onResume() implementation, you should unregister
it in Activity.onPause(). (You won't receive intents when paused, and this will cut down on
unnecessary system overhead). Do not unregister in Activity.onSaveInstanceState(), because this
won't be called if the user moves back in the history stack.
There are two major classes of broadcasts that can be received:
Normal broadcasts (sent with Context.sendBroadcast) are completely asynchronous. All receivers of
the broadcast are run in an undefined order, often at the same time. This is more efficient, but means that
receivers cannot use the result or abort APIs included here.
Ordered broadcasts (sent with Context.sendOrderedBroadcast) are delivered to one receiver at a
time. As each receiver executes in turn, it can propagate a result to the next receiver, or it can completely
abort the broadcast so that it won't be passed to other receivers. The order receivers run in can be
controlled with the android:priority attribute of the matching intent-filter; receivers with the same
priority will be run in an arbitrary order.
Even in the case of normal broadcasts, the system may in some situations revert to delivering the
broadcast one receiver at a time. In particular, for receivers that may require the creation of a process,
only one will be run at a time to avoid overloading the system with new processes. In this situation,
however, the non-ordered semantics hold: these receivers still cannot return results or abort their
broadcast.

Note that, although the Intent class is used for sending and receiving these broadcasts, the Intent
broadcast mechanism here is completely separate from Intents that are used to start Activities with
Context.startActivity(). There is no way for a BroadcastReceiver to see or capture Intents used with
startActivity(); likewise, when you broadcast an Intent, you will never find or start an Activity. These
two operations are semantically very different: starting an Activity with an Intent is a foreground
operation that modifies what the user is currently interacting with; broadcasting an Intent is a
background operation that the user is not normally aware of.
The BroadcastReceiver class (when launched as a component through a manifest's <receiver> tag) is
an important part of an application's overall lifecycle.
e. ContentProvider
Content providers manage access to a structured set of data. They encapsulate the data, and provide
mechanisms for defining data security. Content providers are the standard interface that connects data in
one process with code running in another process.
When you want to access data in a content provider, you use the ContentResolver object in your
application's Context to communicate with the provider as a client. The ContentResolver object
communicates with the provider object, an instance of a class that implements ContentProvider. The
provider object receives data requests from clients, performs the requested action, and returns the
results.
You don't need to develop your own provider if you don't intend to share your data with other
applications. However, you do need your own provider to provide custom search suggestions in your
own application. You also need your own provider if you want to copy and paste complex data or files
from your application to other applications.
Android itself includes content providers that manage data such as audio, video, images, and
personal contact information. You can see some of them listed in the reference documentation for the
android.provider package. With some restrictions, these providers are accessible to any Android
application.
f. Intent
An Intent is an abstract description of an operation to be performed. It can be used with startActivity
to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and
startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background
Service.
An Intent provides a facility for performing late runtime binding between the codes in different
applications. Its most significant use is in the launching of activities, where it can be thought of as the
glue between activities. It is basically a passive data structure holding an abstract description of an
action to be performed.
The primary pieces of information in an intent are:
action -- The general action to be performed, such as ACTION_VIEW, ACTION_EDIT,
ACTION_MAIN, etc.
data -- The data to operate on, such as a person record in the contacts database, expressed as a
Uri.
Some examples of action/data pairs are:

ACTION_VIEW content://contacts/people/1 -- Display information about the person whose


identifier is "1".
ACTION_DIAL content://contacts/people/1 -- Display the phone dialer with the person filled
in.
ACTION_VIEW tel:123 -- Display the phone dialer with the given number filled in. Note how
the VIEW action does what what is considered the most reasonable thing for a particular URI.
ACTION_DIAL tel:123 -- Display the phone dialer with the given number filled in.
ACTION_EDIT content://contacts/people/1 -- Edit information about the person whose
identifier is "1".

Heres a small code for a Login App developed during the training.
Java Code
package com.example.loginapp;
import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
@TargetApi(Build.VERSION_CODES.GINGERBREAD) public class MainActivity extends Activity
{
TextView tv;
EditText usn, pwd;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
tv = (TextView)findViewById(R.id.tv);
usn = (EditText)findViewById(R.id.username);
pwd = (EditText)findViewById(R.id.password);
}
public void click(View v)
{
String user = usn.getText().toString();
String pass = pwd.getText().toString();
if(user.equalsIgnoreCase("Anuj") && pass.equals("password"))
{
tv.setText("Welcome to Ooty! Nice to meet YOU");
}
else if(user.isEmpty() || pass.isEmpty())

{
tv.setText("Don't leave the textboxes empty");
}
else
{
tv.setText("The username and password do not match");
}
}
}
XML Code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.loginapp.MainActivity$PlaceholderFragment" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/usn"
android:text="UserName" />
<TextView
android:layout_marginTop="25dp"
android:layout_below="@id/usn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/pwd"
android:text="Password" />
<EditText
android:id="@+id/username"
android:layout_toRightOf="@id/usn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/usn" />
<EditText
android:id="@+id/password"
android:layout_toRightOf="@id/pwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"

android:layout_alignTop="@id/pwd"
android:inputType="textPassword" />
<Button
android:id="@+id/btn"
android:layout_below="@id/pwd"
android:layout_marginTop="25dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:onClick="click" />
<TextView
android:id="@+id/tv"
android:layout_below="@id/btn"
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>

3. OUTCOME OF TRAINING
In this training our main motive was to understand the working of android applications and their
development. The main reasons for choosing Android as the platform are:
1. Low Investment & High ROI
Android comparatively has a low barrier to entry. Android provides freely its Software Development
Kit (SDK) to the developer community which minimizes the development and licensing costs. The
development costs can be divided into three stages: Stage#1 application development, Stage#2
testing, and Stage#3 hardware cost for testing and deploying the android mobile application.
2. Open Source
Get the open source advantage from licensing, royalty-free, and the best technology framework
offered by the Android community. The architecture of the Android SDK is open-source which means
you can actually interact with the community for the upcoming expansions of android mobile
application development. This is what makes the Android mobile application development platform very
attractive for handset manufacturers & wireless operators, which results in a faster development of
Android based phones, and better opportunities for developers to earn more. Thats the magic of
Android.
3. Easy to Integrate
Are you looking for complex technical customization and integration of a web application or just a
smartphone application you already have? Yes. Then an android app can be the right solution for you.
The entire platform is ready for customization. You can integrate and tweak the mobile app according to
your business need. Android is the best mobile platform between the application and processes
architecture. Most of the platforms allow background processes helping you to integrate the apps.
4. Multiple Sales Channels
Unlike other mobile platforms, Android applications can be deployed in different ways. You do not
have to rely on a single market to distribute your applications. You can use third-party application
marketplace (especially in Google Android Market), but you can also form your own distribution and
sales channel: applications for vertical markets, to develop new application stores, and also place it on
your website. You build it, you publish it. With your choice of promotional strategy, you can reach your
end users through multiple channels.
5. Easy Adoption
Android applications are scripted in Java language with the help of a rich set of libraries. Anyone can
build Android applications with the knowledge of Java. According to a recent survey, a lot of Java
programmers find it easy to adopt and script code for mobile applications in the Android OS. It is now
very beneficial for Java developers to transition the code script into a mobile application, and can also
implement android application development services in the app.
During the training I learned how android apps are developed, what type of sensors are used in a
mobile, how each sensor works and how we should use them, how to access the services of the system,
etc. We also got to know how a mobile works and how it differs from the working of computer.

Vous aimerez peut-être aussi