Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Android 101
http://bitly.com/GH8fnk
Eric CloningerEric CloningerProduct Line Manager
d lProject Lead, Eclipse S
@ericcloninger@ecmoto@
r, Motorola MobilityhSequoyah
PrerequisitesPrerequisites
J 1 5 i t blJava 1.5 is acceptable,Java JRE 1.6 installed,,Java 1.7 isn’t advised rcompatibility)compatibility)
ith li it ti with limitations preferably JDKp y
right now (use 1.6 source
Android DownloaAndroid Downloa
A d id SDK “St t ”Android SDK “Starter” phttp://developer.android
At least one “platform”, Use the Android SDK mUse the Android SDK minstall
adsads
k ( 35MB)package (~35MB)d.com/sdk
possibly 2 (or 3)manager to download andmanager to download and
ger
anag
K M
aSD
Koi
d S
ndro
An
Android SDK ManAndroid SDK Mannagernager
Platform downloaPlatform downloa
A d id SDK M iAndroid SDK Manager is sOS releases
Each OS release can haveEach OS release can have under 1 named releaseDistinguish between OS na(“Gingerbread” “2 3 4” API( Gingerbread , 2.3.4 , API
You may need more than Ice Cream Sandwich (ICS, Honeycomb (aka Android 3“Something” for older Andro
Platforms are backward coPlatforms are backward co1.5 (“Cupcake”) if you man
adsads
t d b API l l tsegregated by API levels, not
several API releases aggregatedseveral API releases aggregated
mes, OS versions, and API levels I 10)I 10)1 platform download…aka Android 4.0, API level 15)
3.0, API level 13) for original tabletsoid phones (API level <= 10)ompatible to Android versionompatible to Android version nage API usage correctly
Platform levelsPlatform levels
also… also …
“SDK Add ” f OE“SDK Addons” from OEDevice-specific emulatoDevice “skins” for generTest supporting apps onTest supporting apps oncorresponding hardware
Libraries such as AdMLibraries, such as AdMSamples for each platfoDocumentation for eac
EM d G lEMs and Googleor images and librariesric emulator imagesn the emulator withoutn the emulator without eob and Licensingob and Licensingormh platform
When you’re readplatforms docs splatforms, docs, sthem up and…
dy to download samples queuesamples, queue
courtesy Petr Kratochvil
Setup SDKSetup SDK
I t ll th A d id SDKInstall the Android SDKpreferably with a short Add the <SDKPATH>/t<SDKPATH>/platform-environment PATH var
K i t i t f ldK into a convenient folder, path nametools and tools folders to your y
riable
Create an EmulatCreate an Emulat
AVD A d id Vi tAVD == Android VirtuaImage
tor Imagetor Image
l D i E l tl Device == Emulator
Create an AVDCreate an AVD
T tTarget: Android APIsGoogle APIsOEM SDK addon
Snapshot modeSD CardSD CardFirst launch
Eclipse StuffEclipse Stuff
E li IDE f J DEclipse IDE for Java Dehttp://www.eclipse.org/dAlternate – Eclipse Clas
Android Developer Toopfor Eclipse
Use “Install New SoftwaUse Install New Softwa− Online: https://dl-ssl.goo− Archive: http://dl.google.p g g
latest version number, o
levelopersdownloads/ssicols (aka “ADT”) plugins( ) p g
are” menu itemare menu itemogle.com/android/eclipse/com/android/ADT-17.0.0.zip (or p (
often matched to SDK)
What to expect frWhat to expect fr
htt //d l d idhttp://developer.android.coWebView.html
Familiar APIsjava.math, java.io, java.j j jorg.apache.http.*DOM SAX JSONDOM, SAX, JSON
Rich API set in android.* toA ti iti I t tActivities, Intents, mess
rom Androidrom Android
/ f / d id/ bkit/om/reference/android/webkit/
.lang, java.util, etc.g j
o handle the life cyclei h dlsage passing, handlers
The Activity LifecThe Activity Lifeccyclecycle
Creating your firsCreating your firsst projectst project
Device DashboarDevice Dashboar
d l d iddeveloper.android.comatform-versions.html
rdrd
/ /d hb d/ l/resources/dashboard/pl
Platform Codename AAndroid 1.5 Cupcake 3Android 1.5 Cupcake 3Android 1.6 Donut 4Android 2.1 Eclair 7Android 2.2 Froyo 8Android 2.3 -Android 2 3 2
Gingerbread 9Android 2.3.2Android 2.3.3 -Android 2.3.7
1
Android 3.0 Honeycomb 1Android 3.1 1Android 3.2 1Android 4.0 -Android 4 0 2
Ice Cream Sandwich
1Android 4.0.2 SandwichAndroid 4.0.3 1
API Level Distribution3 0.4%3 0.4%4 0.8%7 6.6%8 25.3%9 0.5%
10 61.5%
11 0.1%12 1.1%13 2.1%14 0.4%
arch
5, 2
012
15 1.2% As
of M
a
Android ManifestAndroid Manifest<? l i "1 0" di " tf<?xml version="1.0" encoding="utf-<manifest xmlns:android="http://sc
package="com.purplefoto.mysampandroid:versionCode="1"android:versionName="1.0" ><uses-sdk android:minSdkVersio
android:targetSdkVersion="1li i d id i "@d<application android:icon="@drandroid:label="@string/app<activity
android:name=".MyNewPrandroid:name .MyNewPrandroid:label="@string<intent-filter>
<action android:na<category
android:name="android.intent.categ</intent-filter> </activity> </ap
tt8"?>-8"?> chemas.android.com/apk/res/android"ple"
on="14“ 14" />
bl /i l h "rawable/ic_launcher"p_name" >
rojectActivity"rojectActivityg/app_name" >
ame="android.intent.action.MAIN" />
gory.LAUNCHER" />pplication> </manifest>
Layout of an AndLayout of an And
A d idM if t lAndroidManifest.xmlMetadata that the Android Muses to find install and lauuses to find, install, and lau
default.properties, build.prMetadata used for buildingMetadata used for building version. build.properties is u
.classpathc asspatUsed by the Java compiler
.project.projectUsed by Eclipse build syste
roid projectroid project
Market and Package Manager nch your appnch your app
ropertiesyour app such as the platformyour app, such as the platform used by Ant.
em
Layout cont’dLayout, cont dtassets
Non-code components that aren‘e.g.: SQLite database that contaig
bin, genGenerated folders where app res
raw Audio and video files, which are a
resresNon-code components, accessibLayouts, icons, drawables, string
src
t in the /res folder.ins initial or default data
sides, output from tools
accessible with R.raw
le with R. syntaxs, animations
Layout of an AndLayout of an AndNon-Localized projectp j
with default folder names
roid projectroid projectLocalized project with p jlanguage- and locale-specific folder names
DebuggingDebugging
T tTargetsEmulator – Start with AVavd <avd_name>’USB connected deviceTCP/IP remote device (VirtualBox with AndroidVirtualBox with Android
VD manager or ‘emulator –
(advanced method)X86X86
Debugging with Acode
U f itUse your favorite searcsource packages for de
A d idquery Android repoInstall code into <SDK_PATH>/platformWorks for stock emulatWorks for stock emulatwith stock ROM
Android Source
h i t fi d b iltch engine to find prebuilt ebugging or use git to
ms/android-14/sourcestor and Nexus devicestor and Nexus devices
C/C++C/C++
d l d iddeveloper.android.comInstalling the NDKgCalling native methodsD b i NDKDebugging NDK appsNDK in Eclipsep
www.eclipse.org/sequoy
/ dk/ dk/i d ht l/sdk/ndk/index.html
yah/
TestingTesting
YYes
Other ways to buOther ways to bu
J S i t/CSS fJavaScript/CSS framewHTML5
ild appsild apps
kworks
Resources for HeResources for He
d l d iddeveloper.android.comstackoverflow.com/queqwww.vogella.de
bil dmobile.dzone.comgroups.google.com/forug p g gadt-dev
elpelp
estions/tagged/androidgg
um/?fromgroups#!forum/g p
OEM SitesOEM Sites
bd b bl kbbdsc.webapps.blackbewww.htcdev.comdeveloper.huaweidevicd l t ldeveloper.motorola.comdeveloper.samsung.cop gwww.developer.sony.co
/ d idrry.com/android
ce.commmom
MOTODEV ResouMOTODEV Resou
W biWebinars developer.motorola.comnterprise
Best Practices Guidedeveloper.motorola.com
to mobilizing your ap_ _ g_y _ p
urcesurces
m/training/?utm_campaign=e
m/docs/whitepapers/a_guidepps/pp
Give Feedback onGive Feedback on
11 Sign In: www.eclip
2 Select Session Eva2 Select Session Eva
3 Vote 3
n the Sessionsn the Sessions
psecon.org
aluatealuate
Thank youThank you
J li ’ P t ti “StJulia’s Presentation “StMobile Applications”
Tomorrow at 11:15 AMReston Suites B
Motorola’s BOF tonight8:00 PM Lake Anne8:00 PM, Lake Anne
Q&A
t ti A l i f Q littatic Analysis for Quality
t! Win Prizes!