Download android

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
PUR
What is Android
• Android is a software stack for mobile devices
that includes an operating system,
middleware and key applications.
• The Android SDK provides the tools and APIs
necessary to begin developing applications on
the Android platform using the Java
programming language.
Worldwide reach, rapid growth
Growth in app consumption: Users download more than 1.5 billion apps
from Google Play each month.
Features
• Application framework enabling reuse and
replacement of components
• Dalvik virtual machine optimized for mobile
devices
• Integrated browser based on the open source
WebKit engine
• Optimized graphics powered by a custom 2D
graphics library; 3D graphics based on the
OpenGL ES 2.1 specification (hardware
acceleration optional)
Features
• SQLite for structured data storage
• Media support for common audio, video, and
still image formats (MPEG4, H.264, MP3, AAC,
AMR, JPG, PNG, GIF)
• GSM Telephony (hardware dependent)
• Bluetooth, EDGE, 3G, and WiFi (hardware
dependent)
• Camera, GPS, compass, and
accelerometer (hardware dependent)
Android Architecture
Application Framework
• By providing an open development platform.
• Developers have full access to the same
framework APIs used by the core applications.
• The application architecture is designed to
simplify the reuse of components; any
application can publish its capabilities and any
other application may then make use of those
capabilities.
Application framework enabled
• A rich and extensible set of Views that can be
used to build an application.
• Content Providers that enable applications to
access data from other applications.
• A Resource Manager, providing access to noncode resources.
Application framework enabled
• A Notification Manager that enables all
applications to display custom alerts in the
status bar
• An Activity Manager that manages the
lifecycle of applications.
Libraries
• Android includes a set of C/C++ libraries used by
various components of the Android system.
• System C library - a BSD-derived implementation
of the standard C system library (libc), tuned for
embedded Linux-based devices
• Media Libraries - based on PacketVideo's
OpenCORE; the libraries support playback and
recording of many popular audio and video
formats, as well as static image files, including
MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
Libraries
• Surface Manager - manages access to the
display subsystem and seamlessly composites
2D and 3D graphic layers from multiple
applications
• LibWebCore - a modern web browser engine
which powers both the Android browser and
an embeddable web view
• SGL - the underlying 2D graphics engine
Libraries
• 3D libraries - an implementation based on
OpenGL ES APIs
• FreeType - bitmap and vector font rendering
• SQLite - a powerful and lightweight relational
database engine available to all applications
Android Runtime
• Android includes a set of core libraries that
provides most of the functionality available in
the core libraries of the Java programming
language.
• Every Android application runs in its own
process, with its own instance of the Dalvik
virtual machine.
Dalvik virtual machine
• Dalvik has been written so that a device can
run multiple VMs efficiently.
• The Dalvik VM executes files in the Dalvik
Executable (.dex) format which is optimized
for minimal memory footprint.
• The Dalvik VM relies on the Linux kernel for
underlying functionality such as threading and
low-level memory management.
Linux Kernel
• Android relies on Linux version 2.6 for core
system services such as security, memory
management, process management, network
stack, and driver model.
• The kernel also acts as an abstraction layer
between the hardware and the rest of the
software stack.
Development
• Rich development environment including a
device emulator, tools for debugging, memory
and performance profiling, and a plugin for
the Eclipse IDE
• Android Studio new Android development
environment based on IntelliJ IDEA. Similar to
Eclipse with the ADT Plugin, Android Studio
provides integrated Android developer tools
for development and debugging.
Android Developer Tools
• The suite of tools that are integrated with the
Eclipse IDE.
• Provides GUI access to many of the command
line SDK tools as well as a UI design tool for
rapid prototyping, designing, and building of
your application's user interface.
The following describes important
features of Eclipse and ADT
• Integrated Android project creation, building,
packaging, installation, and debugging
• SDK Tools integration
• Java programming language and XML editors
• Integrated documentation for Android
framework APIs
SDK Tools Integration
• Traceview
– Allows you to profile your program's execution.
• android
– Provides access to the Android SDK Manager and
AVD Manager.
• Hierarchy Viewer
– Allows you to visualize your application's view
hierarchy to find inefficiencies
SDK Tools Integration
• Pixel Perfect
– Allows you to closely examine your UI to help with
designing and building.
• DDMS
– Provides debugging features including
• adb
– Provides access to a device from your
development system.
Code Editors
• ADT provides custom XML editors to help you
create and edit Android manifests, resources,
menus, and layouts in a form-based or
graphical mode.
• View the segment on the XML editors for
more information.
Code Editors
• Graphical Layout Editor
– Edit and design your XML layout files with a drag
and drop interface.
• Android Manifest Editor
– Edit Android manifests.
• Menu Editor
– Edit menu groups and items.
Code Editors
• Resources Editor
– Edit resources.
• XML Resources Editor
– Edit XML resources.
• Java source and refaktoring
• Quickly jump to declarations of various types
of resources such as strings or layout files.
Resource linking enhancements
• Resource linking enhancements
• A resource identifier, such as R.id.button1.
• A declaration in the R.java file, such as public
static final int Button01=0x7f050000", is link to
the corresponding XML definition.
• An activity or service definition in your manifest,
such as <activity android:name=".TestActivity">,
is link to the corresponding Java class.
• The value definition (e.g. @string:foo) is link to
regardless of which XML file "foo" is defined in.
Resource linking enhancements
• Links to file-based declaration, such as @layout/bar.
• Non-XML resources, such as @drawable/icon in this
case is an image.
• @android namespace resources.
• Custom views in XML layouts, such
as <foo.bar.MyView></foo.bar.MyView>, or <view
class="foo.bar.MyView">) is linked with corresponding
custom view classes.
• An XML attribute such
as @android:string/ok or android.R.string.id in Java
code opens the file that declares the strings.
Code Managment
• Android applications are written in the Java
programming language.
• The Android SDK tools compile the code into an
Android package (.apk suffix).
• All the code in a single .apk file is considered to
be one application and is the file that Androidpowered devices use to install the application.
• Resources that are separate from the application
code and allow your application to gracefully
optimize its behavior for a variety of device
configurations.
Running application
• The Android operating system is a multi-user
Linux system in which each application is a
different user.
• By default, the system assigns each
application a unique Linux user ID. The system
sets permissions for all the files in an
application so that only the user ID assigned
to that application can access them.
Running application
• Each process has its own virtual machine
(VM), so an application's code runs in isolation
from other applications.
• By default, every application runs in its own
Linux process.
• Android starts the process when any of the
application's components need to be
executed.
Android Security
• In this way, the Android system implements
the principle of least privilege.
• That is, each application, by default, has
access only to the components that it requires
to do its work and no more.
• This creates a very secure environment in
which an application cannot access parts of
the system for which it is not given
permission.
Android Security
• An application can request permission to
access device data such as the user's contacts,
SMS messages, the mountable storage (SD
card), camera, Bluetooth, and more. All
application permissions must be granted by
the user at install time.
Application Components
• Application components are the essential
building blocks of an Android application.
• Each component is a different point through
which the system can enter your application.
• There are four different types of application
components.
• Each type serves a distinct purpose and has a
distinct lifecycle that defines how the
component is created and destroyed.
Activities
• An activity represents a single screen with a
user interface.
• The activities work together as the
application.
• They are independent of the eache others.
• An activity is implemented as a subclass of
android.app.Activity.
Services
• A service is a component that runs in the
background.
• Does not provide a user interface.
• A service is implemented as a subclass of
android.app.Service.
Content providers
• Ma shared set of application data.
• Content provider provide other applications
access or modify the data.
• Content providers are also useful for reading and
writing data that is private to application and not
shared.
• A content provider is implemented as a subclass
of android.app.ContentProvider.
• They must implement a standard set of APIs that
enable other applications to perform
transactions.
Appliactions structure
• Any application can start another application’s
component.
• Android applications don't have a single entry
point (there's no main() function).
• Application cannot directly activate a
component from another application.
• The system activates the component for you
using intents.
Asynchronous messages
• Components (activities, services, and
broadcast receivers) are activated by an
asynchronous message called an intent.
• Intents bind individual components, whether
the component belongs to your application or
another.
• An intent is created with an
android.content.Intent object, which defines
a message.
Asynchronous messages
• For activities and services, an intent defines
the action to perform.
• Intent may specify the URI of the data to act
on.
• An activity to receive a result from other
activity throw an Intent.
• For broadcast receivers, the intent simply
defines the announcement being broadcast.