Sie sind auf Seite 1von 17

Android Emulator or AVD

Emulator is essential to testing app but is not a


substitute for a real device
Emulators are called Android Virtual Devices (AVDs)
Android SDK and AVD Manager allows you to create
AVDs that target any Android API level
AVD have configurable resolutions, RAM, SD cards,
skins, and other hardware

Android Emulator: 1.6 Device

Android Emulator: 2.2 Device

Android Emulator: 3.0 Device

Emulator Basics
Host computers keyboard works
Hosts mouse works like finger
Uses hosts Internet connection

Side buttons work: Home, Menu, Back, Search, volume

up and down, etc.


Ctrl-F11 toggle landscape portrait
Alt-Enter toggle full-screen mode
More info at
http://developer.android.com/guide/developing/devices/emulator.htm
l

Emulator Limitations
No support for placing or receiving actual phone calls
Simulate phone calls (placed and received) through the emulator
console
No support for USB connections
No support for camera/video capture (input)
No support for device-attached headphones
No support for determining connected state
No support for determining battery charge level and AC

charging state
No support for determining SD card insert/eject
No support for Bluetooth
No support for simulating the accelerometer
Use OpenIntentss Sensor Simulator

Differences between Smart


Phones
Feature

Android

Windowsmobile

BlackBerry

company

Google

OS family
Languages

Linux
Java

Microsoft
Windows

RIM
MobileOS

Visual C++

C++

SDK Platform

Multiplatform

dependent

dependent

Facebook

Yes

Yes

Yes

Multitasking
issues

Yes
No

limited
Distributed

limited
Yes

Android Apps
Built using Java and new SDK libraries
No support for some Java libraries like Swing & AWT
Oracle currently suing Google over use
Java code compiled into Dalvik byte code (.dex)
Optimized for mobile devices (better memory
management, battery utilization, etc.)
Dalvik VM runs .dex files

Applications Are Boxed


By default, each app is run in its own Linux process
Process started when apps code needs to be executed
Threads can be started to handle time-consuming
operations
Each process has its own Dalvik VM
By default, each app is assigned unique Linux ID
Permissions are set so apps files are only visible to that
app

Producing an Android App


Java code
.java

javac

Byte code
.class

dx

Dalvik
exe
classes.dex

Byte code
Other .class files

aapt

<xml>
AndroidManifest.x
ml

.apk

<str
>

Resources
11

Structure of an Android Application


Android apps are
stored in packages
Resources:
Data, sound files, images

java
java
code
code

data

mp3

# library calls

aapt

MyApp.apk

Application Components
Activity
An activity represents a single screen with a user interface. An activity is

implemented as a subclass of Activity


Example: a list of menu items users can choose from
Services
A service is a component that runs in the background to perform longrunning operations or to perform work for remote processes. A service does
not provide a user interface.
Example: For example, a service might play music in the background while the
user is in a different application
Broadcast Receivers
A broadcast receiver is a component that responds to system-wide broadcast
announcements.
Example: a broadcast announcing that the screen has turned off, the battery is
low, or a picture was captured.
Content Providers
Store and retrieve data and make it accessible to all applications
Example: Android ships with a number of content providers for common data
types (e.g., audio, video, images, personal contact information, etc.)

Activity

Service

Broadcas
t Receiver

Content
Resolver

Content
Provider

Intents

Building Blocks

Alarm
Manager

Notification
Manager

Other Components

Read more - http://developer.android.com/guide/topics/fundamentals.html

Life
Cycle
Each application runs in its own process.
Each activity of an app is run in the apps process
Processes are started and stopped as needed to run an

apps components.
Processes may be killed to reclaim needed resources.
Killed apps may be restored to their last state when
requested by the user

Management
Most management of the life cycle is done automatically by

the system via the activity stack.


The activity class has the following method callbacks to
help you manage the app:
onCreate()
onStart()
onResume()
onPause()
onStop()
onRestart()
onDestroy()

Das könnte Ihnen auch gefallen