Unit1 21CS1702 - Mobile Application Development

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

21CS1702 - MOBILE APPLICATION DEVELOPMENT

UNIT I
INTRODUCTION TO ANDROID OS 9
ndroid: An Open Platform for Mobile Development- Introducing the Open
Handset Alliance- Introducing the Development Framework- Developing
for Android- Developing for Mobile and Embedded Devices- Android
Development Tools- Introducing the Application Manifest File -The
Android Application Lifecycle.

n Open An Open Platforms for Mobile Development

1. Introduction to Mobile Development Platforms

• Mobile Development Platforms: Environments or frameworks


enabling developers to create applications for mobile devices.

Types of Mobile Applications:

o Native Apps: Built specifically for a particular operating system


(iOS, Android).

o Hybrid Apps: Built using web technologies but run inside a


native container.

o Web Apps: Accessible through a web browser, built using web


technologies.

2. Open Source Mobile Development Platforms

• Definition: Open source platforms provide source code that is freely

1
available for anyone to use, modify, and distribute.

Benefits:

o Cost-effective
o Community support
o Flexibility and customization
o Transparency

3. Popular Open Source Mobile Development Platforms

a. Android

• Overview: Android is an open-source operating system by Google,


widely used in smartphones and tablets.

• Development Tools:
o Android Studio: Official IDE for Android development.
o Languages: Java, Kotlin.
o Key Features: Emulator, layout editor, APK analyzer, intelligent
code editor.

• Advantages:

o Large community support


o Rich documentation
o Extensive libraries and frameworks
b. Flutter

• Overview: An open-source UI software development toolkit by


Google for building natively compiled applications.
• Development Tools:
o Dart: Programming language used in Flutter.
o Hot Reload: Feature allowing quick iterations.

2
• Key Features: Single codebase for iOS and Android, customizable
widgets, high-performance rendering engine.
• Advantages:
o Fast development
o High-performance apps
o Growing community

c. React Native

• Overview: A JavaScript framework for writing real, natively rendering mobile applications
for iOS and Android.
• Development Tools:
o JavaScript/TypeScript: Programming languages used.
o Expo: Set of tools and services for building React Native apps.
• Key Features: Reusable components, fast refresh, vast ecosystem.
• Advantages:
o Single codebase for multiple platforms
o Strong community and library support
o Backed by Facebook

d. Ionic

• Overview: An open-source framework for building cross-platform apps using web


technologies.
• Development Tools:
o HTML, CSS, JavaScript: Core technologies.
o Capacitor: Native runtime providing access to native APIs.
• Key Features: Extensive library of components, integration with Angular, React, and Vue.
• Advantages:
o Easy learning curve for web developers
o Strong community support
o Versatile and flexible

4. Development Environment Setup

• IDE/Editors: Android Studio, Visual Studio Code, IntelliJ IDEA.


• Emulators/Simulators: Android Emulator, iOS Simulator.
• Version Control: Git and GitHub.
• Package Managers: npm (for JavaScript/TypeScript), pub (for Dart).

5. Key Concepts in Mobile Development

• User Interface (UI) Design: Importance of responsive and intuitive UI.


• State Management: Techniques to manage the state in mobile apps (e.g., Redux, Provider).
• Networking: Handling API calls and managing data fetching.
• Data Storage: Local storage options like SQLite, SharedPreferences, and secure storage.
• Testing: Unit testing, integration testing, and end-to-end testing frameworks (e.g., Jest,
Espresso).

3
6. Challenges in Mobile Development

• Fragmentation: Multiple devices and screen sizes.


• Performance: Ensuring smooth performance across various devices.
• Security: Protecting data and ensuring app security.
• Updates: Keeping up with OS updates and new device capabilities.

7. Future Trends in Mobile Development

• AI and Machine Learning: Integration for enhanced user experiences.


• AR/VR: Augmented Reality and Virtual Reality applications.
• 5G Technology: Faster and more reliable connectivity.
• IoT Integration: Connecting mobile apps with Internet of Things devices.

Introducing the Open Handset


The Open Handset Alliance (OHA) is a collection of more
than 80 technology companies, including hardware
manufacturers, mobile carriers, software developers,
semiconductor companies, and Commercialization companies.
Of particular note are the prominent mobile technology
companies, including Samsung, Motorola, HTC, T-Mobile,
Vodafone, ARM, and Qualcomm. In their own words, the
OHA represents the following:

The OHA hopes to deliver a better mobile software experience


for consumers by providing the platform needed for
innovative mobile development at a faster rate and with higher
quality than existing platforms, without licensing fees for
either software developers or handset manufacturers.

4
WHAT DOES ANDROID RUN ON?

The first Android mobile handset, the T-Mobile G1, was


released in the United States in October 2008. By the
beginning of 2012, more than 300 million Android-compatible
devices have been sold from more than 39 manufacturers, in
more than 123 countries, on 231 different carrier networks.

Rather than being a mobile OS created for a single hardware


implementation, Android is designed to support a large variety
of hardware platforms, from smartphones to tablets and
televisions.

In market terms, the emergence of modern mobile


smartphones — multifunction devices including a phone
but featuring a full-featured web browser, cameras,
media players, Wi-Fi, and location-based services —
has fundamentally changed the way people interact with
their mobile devices and access the Internet.

Mobile-phone ownership easily surpasses computer


ownership in many countries, with more than 3 billion
mobile phone users worldwide. 2009 marked the year
that more people accessed the Internet for the first time
from a mobile phone rather than a PC. Many people
believe that within the next 5 years more people will
access the Internet by mobile phone rather than using
personal computers.

5
The increasing popularity of modern smartphones,
combined with the increasing availability of high-speed
mobile data and Wi-Fi hotspots, has created a huge
opportunity for advanced mobile applications.

The ubiquity of mobile phones, and our attachment to


them, makes them a fundamentally different platform
for development from PCs. With a microphone,
camera, touchscreen, location detection, and
environmental sensors, a phone can effectively become
an extra-sensory perception device.

Smartphone applications have changed the way people


use their phones. This gives you, the application
developer, a unique opportunity to create dynamic,
compelling new applications that become a vital part of
people’s lives.

What Android Has That Other Platforms Don’t Have


• Google Maps applications — Google Maps for
Mobile has been hugely popular, and Android
offers a Google Map as an atomic, reusable control
for use in your applications.

• Background services and applications — Full


support for background applications and services
lets you create applications based on an event-driven
model, working silently while other applications are

6
being used or while your mobile sits ignored until it
rings, flashes, or vibrates to get your attention.

• Shared data and inter-process communication —


Using Intents and Content Providers, Android lets
your applications exchange messages, perform
processing, and share data. Can also use these
mechanisms to leverage the data and functionality
provided by the native Android applications.

• Wi-Fi Direct and Android Beam — Using these


innovative new inter-device communication APIs,
you can include features such as instant media
sharing and streaming.

• Home-screen Widgets, Live Wallpaper, and the


quick search box

Introducing the Development Framework

Android applications normally are written using Java as


the programming language but executed by means of a
custom VM called Dalvik, rather than a traditional Java
VM.

Each Android application runs in a separate process


within its own Dalvik instance, relinquishing all
responsibility for memory and process management to

7
the Android run time, which stops and kills processes as
necessary to manage resources.

Dalvik and the Android run time sit on top of a Linux


kernel that handles low-level hardware interaction,
including drivers and memory management, while a set
of APIs provides access to all the underlying services,
features, and hardware.

What Comes in the Box?

The Android SDK includes everything you need to start


developing, testing, and debugging Android
applications:

The Android APIs — the core of the SDK is the


Android API libraries that provide developer access to
the Android stack. These are the same libraries that
Google uses to create native Android applications.

Development tools — The SDK includes several


development tools that let you compile and debug your
applications so that you can turn Android source code
into executable applications.

The Android Virtual Device Manager and emulator —


The Android emulator is a fully interactive mobile
device emulator featuring several alternative skins. The
emulator runs within an Android Virtual Device (AVD)
that simulates a device hardware configuration. Using
8
the emulator you can see how your applications will
look and behave on a real Android device.

All Android applications run within the Dalvik VM, so


the software emulator is an excellent development
environment — in fact, because it’s hardware-neutral, it
provides a better independent test environment than any
single hardware implementation.

Full documentation — The SDK includes extensive


code-level reference information detailing exactly what
’s included in each package and class and how to use
them. In addition to the code documentation, Android’
s reference documentation and developer guide explains
how to get started, gives detailed explanations of the
fundamentals behind Android development, highlights
best practices, and provides deep-dives into framework
topics.

Sample code — The Android SDK includes a selection


of sample applications that demonstrate some of the
possibilities available with Android, as well as simple
programs that highlight how to use individual API
features.

Online support — Android has rapidly generated a


vibrant developer community. The Google Groups
(http://developer.android.com/resources/community-
groups .html # Application Developer Lists) are active

9
forums of Android developers with regular input from
the Android engineering and developer relations teams
at Google. Stack Overflow
(www.stackoverflow.com/questions/tagged/android) is
also a hugely popular destination for Android questions
and a great place to find answers to beginner questions.

For those of you using Eclipse, Android has released the


Android Development Tools (ADT) plugin that
simplify project creation and tightly integrates Eclipse
with the android emulator and the build and debugging
tools. The features of the ADT plug-in are covered in
more detail in Chapter 1.

Understanding the Android Software Stack

The Android software stack is, put simply, a Linux


kernel and a collection of C/C++ libraries exposed
through an application framework that provides services
for, and management of, the run time and applications.
The Android software stack is composed of the
elements shown in Figure 1-1.

Linux kernel — Core services (including hardware


drivers, process and memory management, security,
network, and power management) are handled by a
Linux 2.6 kernel. The kernel also provides an

10
abstraction layer between the hardware and the
remainder of the stack.

Libraries — Running on top of the kernel, Android


include various C/C++ core libraries such as libc and
SSL, as well as the following:

• A media library for playback of audio and video


media
• A surface manager to provide display management
• Graphics libraries that include SGL and OpenGL
for 2D and 3D graphics
• SQLite for native database support
• SSL and WebKit for integrated web browser and
Internet security

Android run time — the run time is what makes an


Android phone an Android phone rather than a mobile
Linux implementation. Including the core libraries and
the Dalvik VM, the Android run time is the engine that
powers your applications and, along with the libraries,
forms the basis for the application framework.

Core libraries — although most Android application


development is written using the Java language, Dalvik
is not a Java VM. The core Android libraries provide
most of the functionality available in the core Java
libraries, as well as the Android specific libraries.

11
Dalvik VM — Dalvik is a register-based Virtual
Machine that’s been optimized to ensure that a device
can run multiple instances efficiently. It relies on the
Linux kernel for threading and low-level memory
management.

Application framework — the application framework


provides the classes used to create Android applications.
It also provides a generic abstraction for hardware
access and manages the user interface and application
resources.
Application layer — all applications, both native and
third-party, are built on the application layer by means
of the same API libraries. The application layer runs
within the Android run time, using the classes and
services made available from the application
framework.

12
The Dalvik Virtual Machine

One of the key elements of Android is the Dalvik VM.


Rather than using a traditional Java VM such as Java
ME, Android uses its own custom VM designed to
ensure that multiple instances run efficiently on a single
device.
13
The Dalvik VM uses the device’s underlying Linux
kernel to handle low-level functionality, including
security, threading, and process and memory
management. It’s also possible to write C/C++
applications that run closer to the underlying Linux OS.
Although you can do this, in most cases there’s no
reason you should need to.

If the speed and efficiency of C/C++ is required for


your application, Android provides a Native
Development Kit (NDK). The NDK is designed to
enable you to create C++ libraries using the libc and
libm libraries, along with native access to OpenGL.

Android Application Architecture


Android’s architecture encourages component reuse,
enabling you to publish and share Activities, Services,
and data with other applications, with access managed
by the security restrictions you define.

The same mechanism that enables you to produce a


replacement contact manager or phone dialler can let
you expose your application’s components in order to
let other developers build on them by creating new UI
front ends or functionality extensions.

14
The following application services are the architectural
cornerstones of all Android applications, providing the
framework you’ll be using for your own software:

Activity Manager and Fragment Manager — Control


the lifecycle of your Activities and Fragments,
respectively, including management of the Activity
stack (described in Chapters 3 and 4).

• Views — used to construct the user interfaces for


your Activities and Fragments, as described in
Chapter 4.

• Notification Manager — provides a consistent and


nonintrusive mechanism for signalling your users,
as described in Chapter 10.

• Content Providers — Lets your applications share


data, as described in Chapter 8.
• Resource Manager — Enables non-code resources,
such as strings an d graphics, to be externalized,
as shown in Chapter 3.
• Intents — provides a mechanism for transferring
data between applications and their components,
as described in Chapter 5.

15
Android Libraries

Android offers a number of APIs for developing your


applications. Rather than list them all here, check out
the documentation at
http://developer.android.com/reference/packages.html,

which gives a complete list of packages included in the


Android SDK.

Android is intended to target a wide range of mobile


hardware, so be aware that the suitability and
implementation of some of the advanced or optional
APIs may vary depending on the host device.

Developing for Android

The Android SDK includes all the tools and APIs you
need to write compelling and powerful mobile
applications. The biggest challenge with Android, as
with any new development toolkit, is learning the
features and limitations of its APIs.

If you have experience in Java development, you’ll fi


nd that the techniques, syntax, and grammar you’ve
been using will translate directly into Android, although
some of the specific optimization techniques may seem
counterintuitive.

16
If you don’t have experience with Java but have used
other object-oriented languages (such as C#), you
should find the transition straightforward. The power of
Android comes from its APIs, not the language being
used, so being unfamiliar with some of the Java -
specific c classes won’t be a big disadvantage.

What You Need to Begin?

Because Android applications run within the Dalvik


VM, you can write them on any platform that supports
the developer tools. This currently includes the
following:

Microsoft Windows (XP or later)


‰ Mac OS X 10.5.8 or later (Intel chips only)
‰ Linux (including GNU C Library 2.7 or later)

DEVELOPING FOR MOBILE AND EMBEDDED DEVICES

Android does a lot to simplify mobile- or embedded-


device software development, but you need to
Understand the reasons behind the conventions. There
are several factors to account for when writing software
for mobile and embedded devices, and when developing
for Android in particular.

17
Hardware-Imposed Design Considerations

Small and portable, mobile devices offer exciting


opportunities for software development. Their limited
Screen size and reduced memory, storage, and
processor power are far less exciting, and instead
present some unique challenges.

Compared to desktop or notebook computers, mobile


devices have relatively:

• Low processing power


• Limited RAM
• Limited permanent storage capacity
• Small screens with low resolution
• High costs associated with data transfer
• Intermittent connectivity, slow data transfer rates,
and high latency
• Unreliable data connections
• Limited battery life

Each new generation of phones improves many of


these restrictions. In particular, newer phones have
dramatically improved screen resolutions and signifi
cantly cheaper data costs.

Be Efficient
Manufacturers of embedded devices, particularly
mobile devices, generally value small size and long

18
battery life over potential improvements in processor
speed. For developers, that means losing the head start
traditionally afforded thanks to Moore’s law (the
doubling of the number of transistors placed on an
integrated circuit every two years). In desktop and
server hardware, this usually results directly in
processor performance improvements; for mobile
devices, it instead means thinner, more power-efficient
mobiles, with brighter, higher resolution screens. By
comparison, improvements in processor power take a
back seat.

In practice, this means that you always need to optimize


your code so that it runs quickly and responsively,
assuming that hardware improvements over the lifetime
of your software are unlikely to do you any favors.

Code efficiency is a big topic in software engineering,


so I’m not going to try and cover it extensively there.
Later in this chapter you’ll learn some Android-specifi
c efficiency tips, but for now note that efficiency is
particularly important for resource-constrained
platforms.

Expect Limited Capacity

Advances in flash memory and solid-state disks have


led to a dramatic increase in mobile-device storage

19
capacities. (MP3 collections still tend to expand to fill
the available storage.) Although an 8GB fl ash drive or
SD card is no longer uncommon in mobile devices,
optical disks offer more than 32GB, and terabyte drives
are now commonly available for PCs. Given that most
of the available storage on a mobile device is likely to
be used to store music and movies, many devices offer
relatively limited storage space for your applications.

Android lets you specify that your application can


be installed on the SD card as an alternative to using
internal memory (described in detail in Chapter 3), but
there are significant restrictions to this approach and it
isn’t suitable for all applications. As a result, the
compiled size of your application is an important
consideration, though more important is ensuring that
your application is polite in its use of system resources.

Design for Different Screens

The small size and portability of mobiles are a


challenge for creating good interfaces, particularly
when users are demanding an increasingly striking and
information-rich graphical user experience.

Combined with the wide range of screen sizes that make


up the Android device ecosystem, creating consistent,
intuitive, and pleasing user interfaces can be a signifi
cant challenge.
20
Expect Low Speeds, High Latency

The ability to incorporate some of the wealth of online


information within your applications is incredibly
powerful. Unfortunately, the mobile Web isn’t as fast,
reliable, or readily available as we would like; so, when
you’re developing your Internet-based applications,
it’s best to assume that the network connection will be
slow, intermittent, and expensive.

With unlimited 4G data plans and citywide Wi-Fi, this


is changing, but designing for the worst case ensures
that you always deliver a high-standard user experience.
This also means making sure that your applications can
handle losing (or not finding) a data connection.

Design for Different Screens The small size and


portability of mobiles are a challenge for creating good
interfaces, particularly when users are demanding an
increasingly striking and information-rich graphical
user experience.

Combined with the wide range of screen sizes that make


up the Android device ecosystem, creating consistent,
intuitive, and pleasing user interfaces can be a signifi
cant challenge.

21
Android devices are now available with a variety of
screen sizes, from small-screen QVGA phones to 10.1"
tablets and 46" Google TVs. As display technology
advances and new Android devices are released, screen
sizes and resolutions will be increasingly varied. To
ensure that your application looks good and behaves
well on all the possible host devices, you need to design
and test your application on a variety of screens,
optimizing for small screens and tablets, but also
ensuring that your UIs scale well on any display.

Considering the User’s Environment

What does this mean in terms of software design? Make


sure that your application:

• Is predictable and well behaved — Start by ensuring


that your Activities suspend when they’re not in
the foreground. Android fi res event handlers when
your Activity is paused or resumed, so you can
pause UI updates and network lookups when your
application isn’t visible there’s no point
updating your UI if no one can see it. If you need to
continue updating or processing in the background,
Android provides a Service class designed for this
purpose, without the UI overheads.

• Switches seamlessly from the background to the


foreground — With the multitasking nature of

22
mobile devices, it’s likely that your applications
will regularly move into and out of the background.
It’s important that they “come to life” quickly
and seamlessly. Android’s nondeterministic
process management means that if your application
is in the background, there’s every chance it will
get killed to free resources. This should be invisible
to the user. You can ensure seamlessness by saving
the application state and queuing updates so that
your users don’t notice a difference between
restarting and resuming your application. Switching
back to it should be seamless, with users being
shown the UI and application state they last saw.

• Is polite — your application should never steal


focus or interrupt a user’s current Activity.

Instead, use Notifications (detailed in Chapter 10) to


request your user’s attention when your application
isn’t in the foreground. There are several ways to alert
users — for example,

Presents an attractive and intuitive UI — your application


is likely to be one of several in use at any time, so it’s
important that the UI you present is easy to use. Spend
the time and resources necessary to produce a UI that is
as attractive as it is functional, and don’t force users to
23
interpret and relearn your application every time they
load it. Using it should be simple, easy, and obvious —
particularly given the limited screen space and
distracting user environment.

Is responsive — Responsiveness is one of the most


critical design considerations on a mobile device. You
’ve no doubt experienced the frustration of a “frozen
” piece of software; the multifunctional nature of a
mobile makes this even more annoying. With the
possibility of delays caused by slow and unreliable data
connections, it’s important that your application use
worker threads and background Services to keep your
Activities responsive and, more important,
to stop them from preventing other applications from
responding promptly.

Developing for Android

Nothing covered so far is specific to Android; the


preceding design considerations are just as important in
developing applications for any mobile device. In
addition to these general guidelines, Android has some
particular considerations.

Take a few minutes to read the design best practices


included in Google’s Android Dev Guide at
http://developer.android.com/guide/index.html.

24
The Android design philosophy demands that
applications be designed for:

• Performance
• Responsiveness
• Freshness
• Security
• Seamlessness
• Accessibility

Being Fast and Efficient

In a resource-constrained environment, being fast


means being efficient. A lot of what you already know
about writing efficient code will be applicable to
Android, but the limitations of embedded systems and
the use of the Dalvik VM mean you can’t take things
for granted.

Being Responsive

Android takes responsiveness very seriously. Android


enforces responsiveness with the Activity Manager and
Window Manager. If either service detects an
unresponsive application, it will display an “
[Application] is not responding” dialog — previously
described as a force close error, as shown in Figure
2-13.

25
Android monitors two conditions to determine
responsiveness:
• An application must respond to any user action,
such as a key press or screen touch, within five
seconds.

• A Broadcast Receiver must return from its own


Receive handler within 10 seconds.

Ensuring Data Freshness

The ability to multitask is a key feature in Android. One


of the most important use cases for background Services
is to keep your application updated while it’s not in
use.

Require permissions for any Services you publish or


Intents you broadcast. Take special care when
broadcasting Intent that you aren’t leaking secure
information, such as location data.

Take special care when accepting input to your


application from external sources, such as the Internet,
Bluetooth, NFC, Wi-Fi Direct, SMS messages, or
instant messaging (IM). You can find out more about
using Bluetooth, NFC, Wi-Fi Direct, and SMS for
application messaging in Chapters 16 and 17.
26
• Be cautious when your application may expose
access to lower-level hardware to third-party
Applications.

• Minimize the data your application uses and which


permissions it requires

Ensuring a Seamless User Experience

The idea of a seamless user experience is an important,


if somewhat nebulous, concept. What do we mean by
seamless? The goal is a consistent user experience in
which applications start, stop, and transition instantly
and without perceptible delays or jarring transitions.

Ensuring a Seamless User Experience

The idea of a seamless user experience is an important,


if somewhat nebulous, concept. What do we mean by
seamless? The goal is a consistent user experience in
which applications start, stop, and transition instantly
and without perceptible delays or jarring transitions.

Providing Accessibility

When designing and developing your applications, it’s


important not to assume that every user will be exactly
like you. This has implications for internationalization
and usability but is critical for providing accessible
27
support for users with disabilities that require them to
interact with their Android devices in different ways.

ANDROID DEVELOPMENT TOOLS

The Android SDK includes several tools and utilities to


help you create, test, and debug your projects.

A detailed examination of each developer tool is outside


the scope of this book, but it’s worth briefly reviewing
what’s available. For additional details, check out the
Android documentation at
http://developer.android.com/guide/developing/tools/ind
ex.html.

The Android Virtual Device and SDK Managers —


Used to create and manage AVDs and to download
SDK packages, respectively. The AVD hosts an
Emulator running a particular build of Android, letting
you specify the supported SDK version, screen
resolution, amount of SD card storage available, and
available hardware capabilities (such as touchscreens
and GPS).

The Android Emulator — An implementation of the


Android VM designed to run within an AVD on your
development computer. Use the Emulator to test and
debug your Android applications.

28
Dalvik Debug Monitoring Service (DDMS) — Use the
DDMS to monitor and control the Emulators on which
you’re debugging your applications.

• Android Debug Bridge (ADB) — A client-server


application that provides a link to virtual and
physical devices. It lets you copy files, install
compiled Application Packages (.apk), and run
shell commands.

Logcat — a utility used to view and filter the output of


the Android logging system.

Android Asset Packaging Tool (AAPT) — constructs the


distributable Android package files (.apk).

The following additional tools are also available:


• SQLite3 — A database tool that you can use to
access the SQLite database fi les created and used
by Android.

• Trace view and dm trace dump — Graphical


analysis tools for viewing the trace logs from your
Android application.

• Hprof-conv — A tool that converts HPROF profi


ling output fi les into a standard format to view in
your preferred profiling tool.
29
• MkSDCard — Creates an SD card disk image that
can be used by the Emulator to simulate an
external storage card.

• Dx — Converts Java .class byte code into Android


.dex byte code.

• Hierarchy Viewer — Provides both a visual


representation of a layout’s View hierarchy to
Debug and optimize your UI, and a magnified display to
get your layouts pixel-perfect.

Lint — A tool that analyses your application and its


resources to suggest improvements and optimizations.

• Draw9patch: A handy utility to simplify the


creation of Nine Patch graphics using a
WYSIWYG editor.

• Monkey and Monkey Runner: Monkey runs within


the VM, generating pseudo-random user and
system events. Monkey Runner provides an API
for writing programs to control the VM from
outside your application.

30
• ProGuard — A tool to shrink and obfuscate your
code by replacing class, variable, and method
names with semantically meaningless alternatives.

This is useful to make your code more difficult to


reverse engineer.

The Android Virtual Device Manager

The Android Virtual Device Manager is used to create


and manage the virtual devices that will host
instances of the Emulator.

AVDs are used to simulate the software builds and


hardware configurations available on different physical
devices. This lets you test your application on a variety
of hardware platforms without needing to buy a variety
of phones.

The additional settings include the following:

• Maximum VM heap size


• Screen pixel density
• SD card support
• Existence of D-pad, touchscreen, keyboard,
And trackball hardware
• Accelerometer, GPS, and proximity sensor support
• Available device memory
• Camera hardware (and resolution)
31
• Support for audio recording
• Existence of hardware back and home keys

Android SDK Manager

The Android SDK Manager can be used to see which


version of the SDK you have installed and to install new
SDKs when they are released.

The Android Emulator

The Emulator is available for testing and debugging


your applications.

The Emulator is an implementation of the Dalvik VM,


making it as valid a platform for running Android
applications as any Android phone. Because it’s
decoupled from any particular hardware,it’s an
excellent baseline to use for testing your applications.

The Android Debug Bridge

The Android Debug Bridge (ADB) is a client-service


application that lets you connect with an Android device
(virtual or actual). It’s made up of three components:

• A daemon running on the device or Emulator


• A service that runs on your development computer

32
• Client applications (such as the DDMS) that
communicate with the daemon through the service

The Hierarchy Viewer and Lint Tool

To build applications that are fast and responsive, you


need to optimize your UI. The Hierarchy Viewer and
Lint tools help you analyze, debug, and optimize the
XML layout definitions used within your application.

The Hierarchy Viewer displays a visual representation


of the structure of your UI layout. Starting at the root
node, the children of each nested View (including
layouts) is displayed in a hierarchy. Each View node
includes its name, appearance, and identifier.

*********** UNIT 1 *******

33

You might also like