Android Michael Greifeneder Image source: Android homepage Inhalt - - PowerPoint PPT Presentation

android
SMART_READER_LITE
LIVE PREVIEW

Android Michael Greifeneder Image source: Android homepage Inhalt - - PowerPoint PPT Presentation

Android Michael Greifeneder Image source: Android homepage Inhalt Overwiew Hardware Software Development Tools Basics Debugging/Emulator Location Demo Android And Me Why I like Android Blend of Linux


slide-1
SLIDE 1

Android

Michael Greifeneder

Image source: Android homepage

slide-2
SLIDE 2

Inhalt

  • Overwiew
  • Hardware
  • Software
  • Development
  • Tools
  • Basics
  • Debugging/Emulator
  • Location
  • Demo
slide-3
SLIDE 3

Android And Me

  • Why I like Android
  • Blend of Linux and Java
  • Open (Source)
  • Development on Ubuntu :)
  • USB mass storage
  • Tethering (USB, Wifi)
  • Don't like
  • Battery life
  • Default LookNFeel
slide-4
SLIDE 4

Hardware

  • Typically ARM processors, up to 1 GHz
  • 256-512 MB RAM, up to 1 GB ROM
  • Connectivity: GSM/EDGE, UMTS,

Bluetooth, Wi-Fi, and WiMAX.

  • Cameras, GPS, accelerometers, SD card
  • Optional

physical keyboard

  • ~34 devices...

Image sources: Device manufacturer

slide-5
SLIDE 5

3,4 28 13,8 12,3 4,7 3,1

Forecast 2010 North America

Symbian RIM Apple Google Microsoft Palm

44,3 19,4 15,4 9,6 6,8 3,7 0,7

1Q10 Worldwide Sales

Symbian Research In Motion iPhone OS Android Microsoft Windows Mobile Linux Other OSs

Smartphone Sales Stats

  • North America
  • Source: Canalys
  • Total: 65 Mio
  • Worldwide 1Q10
  • Source: Gartner
  • Total: 54 Mio/Q

http://www.gartner.com/it/page.jsp?id=1372013 http://www.gartner.com/it/page.jsp?id=985912

2008 2009 2010 2 4 6 8 10 12 14 16 18

Q1 Worldwide

Android iPhone

slide-6
SLIDE 6

Markets

  • Google's Android Market (>50.000 Apps)
  • 25$ one-time registration
  • No restrictions
  • Alternatives available (android.pdassi.de)
  • Just click on an .apk file...

http://xkcd.com/662/ Creative Commons Attribution-NonCommercial 2.5 License.

slide-7
SLIDE 7

Software

  • Tweaked Linux kernel (2.6.27-32)
  • No X Window System
  • Dalvik/Java Runtime
  • register-based architecture
  • .dex format
  • dx tool convert .class files to .dex
  • Neither AWT, Swing nor JavaME

supported

  • JIT implementation (Android 2.2)
  • Open Source (Apache license)
slide-8
SLIDE 8

Architecture

http://developer.android.com/guide/basics/what-is-android.html

slide-9
SLIDE 9

Kernel

http://android.git.kernel.org/

From Kevin Mcdonagh slides: http://www.scribd.com/doc/31664622/Android-Source-Code-Guided-Tour

slide-10
SLIDE 10

Versions

  • Cupcake
  • 1.5 (API 3)
  • Donut
  • 1.6 (API 4)
  • Eclair
  • 2.0 (API 5), 2.0.1 (API 6) +2.1 (API 7)
  • FroYo (Frozen Yoghurt)
  • 2.2 (API 8)

Image source: Android homepage

slide-11
SLIDE 11

Development

  • Android SDK
  • → http://developer.android.com/sdk
  • Eclipse + Android Development Tools
  • https://dl-ssl.google.com/android/eclipse/
  • Java+XML
  • C/C++ for NDK

Image source: Self-made screenshots

slide-12
SLIDE 12

Toolset

  • adb (Android Debug Bridge)
  • Installing an Application
  • Copying Files to or from Device/Emulator
  • Remote Shell
  • z.B. Sqlite command-line
  • DDMS (Dalvik Debug Monitor Server)
  • Uses adb
  • middleman btw. IDE + applications
  • logcat
slide-13
SLIDE 13

Emulator

  • Android Virtual Devices (AVD)
  • hardware profile
  • mapping to a system image
  • dedicated storage area
  • Emulator runs AVDs
  • Emulates: Calls, SMS
  • Location, Camera
  • Network-speed

Image source: Self-made screenshots

slide-14
SLIDE 14

Widgets

  • Layout in XML files
  • Layouts: LinearLayout,

RelativeLayout, FrameLayout, TableLayout, AbsoluteLayout(pfui)

  • Basic Widgets: TextView,

Button, EditText, ImageView

  • DatePicker, TimePicker, Tabs
  • OptionMenu, ContextMenu
  • WebView (WebKit)

Image source: Self-made screenshots

slide-15
SLIDE 15

GUI Designer?

  • Android Layout Editor in Eclipse
  • Forget it.
  • DroidDraw http://www.droiddraw.org/
  • Yeah,

but...

Image source: Self-made screenshots

slide-16
SLIDE 16

Project Structure

  • AndroidManifest.xml
  • /src
  • /res
  • /layout
  • /menu
  • /drawable
  • /gen
  • /values/strings.xml
slide-17
SLIDE 17

Security

  • User must confirm access
  • Declare required

permissions in AndroidManifest.xml

  • <uses-permission android:name=

"android.permission.INTERNET"/ >

  • <uses-permission android:name=

"android.permission. ACCESS_FINE_LOCATION" />

  • <uses-permission android:name=

"android.permission.CAMERA" />

Image source: http://www.taosoftware.co.jp/en/android/wakeupcallmaker/

slide-18
SLIDE 18

Activities <--> Intents

  • Activity = One screen
  • Intents (abstract description of an operation)
  • Explicit intents (same app)
  • Implicit intents (inter App operation)
  • Example:
  • Action: Intent.ACTION_DIAL
  • Data: ”tel:01567890”
  • Intent filters
  • Declare receiving of intents
slide-19
SLIDE 19

Activity

  • Methods
  • onCreate
  • setContentView(R.layout.XML_FILE);
  • findViewById(R.id.ID_IN_LAYOUT);
  • onDestroy/onPause/onResume
  • Call internal activity
  • Intent intent = new Intent(this,

OtherActivity.class); startActivity(intent); //or startActivityForResult(intent, 1);

slide-20
SLIDE 20

The Mighty List

  • android.widget.ListView

(ListActivity)

  • ListAdapter for data
  • Indiviual layout for row
  • ArrayAdapter
  • ne Textview in row
  • SimpleCursorAdapter
  • Maps DB columns to resource ids in row

layout

Image source: Self-made screenshots

slide-21
SLIDE 21

Services...

  • Use case
  • Background tasks
  • Long running tasks
  • Implement a service
  • AndroidManiferst.xml

<service android:name=".MyService" />

  • onCreate/onStart/onDestroy
  • onBind() → return a subclassed Binder that

extends Binder and implements custom method: getService()

slide-22
SLIDE 22

Use Service (local)

  • Intent intent = new Intent(this.

Service.class)

  • bindService(intent, serviceConnection, 0);
  • interface ServiceConnection {
  • nServiceConnected(Binder binder,...)
  • nServiceDisconnected(...)}
  • ((LocalBinder) binder).getService()
slide-23
SLIDE 23

Location aware

  • LocationManager
  • getLastKnownLocation
  • Register for periodic updates
  • Get notified on location
  • Emulator
  • Open console
  • telnet localhost <5554?>
  • geo fix <longitude> <latitude>
slide-24
SLIDE 24

Demos

  • DB query
  • Location (Change location in emulator)
  • Camera
  • Intent: android.media.action.IMAGE_CAPTURE is buggy
  • http://code.google.com/p/android/issues/detail?id=1480
  • Workaround: Do it yourself
  • Internet
  • <uses-permission android:name="android.permission.INTERNET"/>
slide-25
SLIDE 25

Source code: http://github.com/mikegr/aLogMyNight eBooks: http://commonsware.com/books ??? Questions/Discussion ???