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
Presented in Open Source Series Workshop 2010
An emerging OS for mobile devices
Android
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Agenda
•
•
•
•
What is an android? (Part 1)
Inside Android (Components) (Part 2)
Writing code for android devices.(Part 3)
Demonstration (Part 4)
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
What is an Android?
(Part 1)
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
About Android (Cont…)
• The word “android” literally means a robot.
• Android is an OS for the mobile devices.
• Android is more than an OS ,it’s complete
software stack.
• Mainly developed by Google
• Product of Open Handset Alliance
• Based on linux kernel
• Ranked 1st in sales of smart devices.
• 100,000 apps freely available for Android.
• Code written in Java language.
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
About Android
• We can create powerful java applications in
android.
• Android phones are called smart mobile devices.
• Android has a potential market beyond mobile
devices.
• Some of android code being written for non
mobile applications.
• Android was made freely available under Apache
open source license in Oct 2008.
• Estimated 3 billion users
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
HTC G1
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Features
• Connectivity: WIFI, Bluetooth and GPRS, EDGE,
and 3G
•
•
•
•
Hardware: Support for GPS, accelerometers and
Cameras.
Graphics: Built in 2D/3D support including
OpenGL.
Storage: SQLLite
Browser: The web browser is based on Webkit
Supports modern features like multi touch and
multi tasking.
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Popular version
Version
Name
1.5
Cupcake (Linux 2.6.27)
1.6
Donut (Linux 2.6.29)
2.0/2.1
Éclair (Linux 2.6.29)
2.2
Froyo (Linux 2.6.32)
2.3
Gingerbread (Linux 2.6.35.7)
3.0/2.4
Honeycomb (2011)
3x/2x
Ice Cream (2011)
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
OS trends
• Android popularity is growing and will soon
challenge Symbian in 2014 [Gartner.com]
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Inside Android Platform
(Part 2)
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Application Architecture
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Inside Android Platform
•
•
•
•
Linux Kernel
Native Libraries
Android Runtime
Application Framework
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Detailed components
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Android Manifest
• Every application must provide a file named
“AndroidManifest.xml “
• Contains the configuration information for
correctly installing it.
• Contains three things
1. Class names
2. Events
3. Permissions
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Developing Applications with Android
(Part 3)
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Tools Needed
•
•
•
•
To develop android applications we need
IDE: Officially Eclipse is used
Android SDK
Android Developer Tools plug-in for Eclipse
• Java Coding in eclipse is very intitutive,
provides rich java environment like context
sensitive help and code suggestions
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Android SDK
• Provides tools and APIs to begin developing
applications on the Android using JAVA.
• Used to build, compile, test and debug user
applications
• Can be downloaded for Linux, Windows and
MAC.
• We can add, delete and update components in
android SDK.
• To begin development we need Eclipse IDE with
ADT plug-in.
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Anatomy of an Android application
Creating and Deploying android application
• Activity
• Service
• Content Provider
• Processes and Tasks.
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Android applications have common
structure
Broadcast receivers
can trigger intents
that start an
application
Activity is the presentation
layer of your app: there will
be one per screen, and the
Views provide the UI to the
activity
Data storage
provide data for
your apps, and can
be shared
between apps –
database, file, and
shared
preferences (hash
map) used by
group of
applications
22-24 December, 2010 © ICOSST 2010
Intents specify what specific
action should be performed
Services run in the
background and have no
UI for the user – they will
update data, and trigger
events
Bruce Scharlau, University of Aberdeen,
2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Android applications have common
structure
Views such as lists,
grids, text boxes,
buttons, and even an
embeddable web
browser
An Activity Manager that
manages the life cycle of
applications and provides a
common navigation
backstack
Content Providers
that enable
applications to
access data from
other applications
(such as Contacts),
or to share their
own data
A Notification Manager that
enables all apps to display
custom alerts in the status
bar
22-24 December, 2010 © ICOSST 2010
A Resource Manager,
providing access to noncode resources such as
localized strings, graphics,
and layout files
Bruce Scharlau, University of Aberdeen,
2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
How it works
Write app in Java
Compiled in Java
Transformed to Dalvik bytecode
Loaded into Dalvik VM
Linux OS
22-24 December, 2010 © ICOSST 2010
Bruce Scharlau, University of Aberdeen, 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
HelloWorld Android
package com.google.android.helloactivity;
import android.app.Activity;
import android.os.Bundle;
public class HelloActivity extends Activity {
public HelloActivity() {
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.hello_activity);
}
}
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Can assume that most have android
2.1 or 2.2
Bruce Scharlau, University of Aberdeen, 2010
22-24 December, 2010 © ICOSST 2010
http://developer.android.com/resources/dashboard/platform-versions.html
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Emulator
• Applications can be run on the device or emulator.
22-24 December, 2010 © ICOSST 2010
Bruce Scharlau, University of Aberdeen, 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
There is a common file structure for
applications
code
Autogenerated
resource list
files
images
UI layouts
constants
22-24 December, 2010 © ICOSST 2010
Bruce Scharlau, University of Aberdeen, 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
The AndroidManifest lists application
details
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my_domain.app.helloactivity">
<application android:label="@string/app_name">
<activity android:name=".HelloActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
22-24 December, 2010 © ICOSST 2010
Bruce Scharlau, University of Aberdeen,
2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Dalvik Virtual Machine
•
•
•
•
Responsible for running android Java programs.
Optimized for low memory.
Designed to allow multiple VM instances to run.
Relies on OS for process isolation, memory
management and threading.
• Executes Dalvik(DEX) files
• DEX files are zipped into android package (APK)
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Android vs IPhone
• Android is open source but iOS is proprietary.
• iOS can only be used on apple machines like
Iphone,Ipad,Ipod
• Android has a universe of diverse mobile devices
manufactured by renowned OEMS.For e.g.
HTC,Samsung,LG,Sony Ericsson,Dell
• e.g Iphone iOS development is restricted while
Android is flexible.
• iOS uses objective C while Android uses wildly
adopted Java language.
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
There are lots of sources of
information
• The sdk comes with the API references, sample
applications and lots of docs
• Blog http://android-developers.blogspot.com/
which has lots of useful examples, details
• There is http://www.anddev.org
22-24 December, 2010 © ICOSST 2010
Bruce Scharlau, University of Aberdeen,
2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Demonstration
22-24 December, 2010 © ICOSST 2010
Presented in Open Source Series Workshop 2010
ICOSST 2010 Android Presentation
Questions?
22-24 December, 2010 © ICOSST 2010