Android Overview
-
Upload
juha-ristolainen -
Category
Technology
-
view
3.043 -
download
1
description
Transcript of Android Overview
Date, time, etc.
Date, time, etc.
What is Android?
• Android is an open-source mobile platform
• Source code available under the Apache license
• http://source.android.com/
• Roadmap available: http://source.android.com/roadmap
• Google apps not open source (Market, Gmail, Maps)
• Built on Linux
• Offers full stack: OS, middleware, applications, developer
APIs and tools, QEMU-based emulator
• Developed by the Open Handset Alliance (OHA)
• Includes companies such as Broadcom, Google, HTC, Intel, LG,
Marvell, Motorola, Nvidia, Quallcom, Samsung, Sprint, T-Mobile, TI
• Strongly driven by Google
Date, time, etc.
So why is Android interesting
• Modern mobile OS that could rival iPhone OS
• Many OEMs
• Still very young but lots of potential
• Platform is developing
• Just starting to get momentum
• Easy to get started with development
• Ready and working store solution
Date, time, etc.
Date, time, etc.
Android timeline
• 2005/07 Google acquires Android, Inc.
• 2007/11 Android is announced by OHA
• Early look SDK made available strait away
• 2008/08 Android market announced
• 2008/09 First Android device announced: T-Mobile G1 (HTC Dream)
• Android SDK 1.0 announced the same day
• 2008/10 Source code released to Android Open Source Project
• Android Market opened. Free apps only
• 2009/02 Android 1.1 released
• Paid apps to UK and US Markets
• 2009/04 Android 1.5 ”Cupcake” released
• 2009/06 Android NDK released.
• 2009/09 Android 1.6 ”Donut” released
Date, time, etc.
Android devices
• HTC has multiple models:
• HTC Dream, 1st ever Android device
• HTC Magic
• HTC Hero
• HTC Tattoo
• ~15 devices on market, and more coming all the time
• HTC, Motorola, LG, Samsung, Philips, Huawei, Lenovo and even
Dell
• Some manufacturers create their own UI layer, e.g. Motorola
MOTOBLUR and HTC SenseUI
Date, time, etc.
Developing for Android
• Easy to get started
• SDK + Eclipse plugin (ADT).
• On-device debugging
• Plenty of documentation: http://developer.android.com/
• OpenIntents-project: http://www.openintents.org/en/
• Applications written in Java
• Not JME or proper JSE. Java language syntax
• Core Android libraries provide most of the functionality in the core
Java libraries as well as additional Android-specific libraries
• NDK enables compiling native code to be used via Java Native
Interface (JNI)
• All application are equal
• You can even replace the dialer app if you want to
Date, time, etc.
Android Software Stack
Date, time, etc.
Dalvik VM
• Register based virtual machine
• As opposed to normal stack based VMs
• Optimized to ensure that a device can run multiple instances
efficiently. More info at http://www.dalvikvm.com/ and
http://sites.google.com/site/io/dalvik-vm-internals
• Uses own bytecode not Java bytecode
• No JIT
• Android programs are compiled into Dalvik executable files (.dex)
which are then zipped into Android packages (.apk).
• Dex-files are used to ensure minimal memory footprint.
• Uncompressed dex-file is usually still smaller than the same Java code
as compressed jar-file.
Date, time, etc.
Android application framework
• Framework services
• Activity manager
• Views
• Notification manager
• Content providers
• Resource manager
• Lots of APIs: telephony, media, sensors, location, WebKit-
based browser, Google Maps, P2P & Google Talk,home
screen widgets,OpenGL, FreeType,SQLite to name a few
Date, time, etc.
Main building blocks
• Activities
• Visible screen of the application
• Services
• Background services
• Content providers
• Share data between activities and applications
• Intents
• Activate services and components
• Broadcast receivers
• Received and react to broadcasted events
• Resources
• Support different localizations and form factors easily
Date, time, etc.
Activity
• Foreground activity is a visible screen in the application
• Handles user interaction and feedback
• Android applications have no exit. Platform handles the
lifecycle.
• Developer takes care of• onCreate
• onStart
• onResume
• Running
• onPause
• onStop
• onRestart
• onDestroy
Date, time, etc.
Date, time, etc.
Service
• Used for background processing for other activities
• Runs still on the main Activity’s thread
• Need to separate to own thread if needed
• Communication using e.g. Handlers if in separate threads
• Lifecycle differs from Activity
• Entire lifecycle vs active lifecycle
• onCreate, onStart, onDestroy or
• onCreate, onBind, onUnbind, (onRebind), onDestroy
• According to starting mechanism.
Date, time, etc.
Service lifecycle
Date, time, etc.
Content providers
• Store and share data between activities and services
• Most content providers use SQLite as the data store
• Usage via ContentResolvers and Content URIs:
• Single row: content://com.futurice.fututwit/tweets/3815526750
• All rows: content://com.futurice.fututwit/tweets/
Date, time, etc.
Intents
• Intents are used to activate other activities or services
• You specify your intent: ”I want to make a phone call to
number 555 2368”
• Intent call = new Intent(Intent.ACTION_DIAL, Uri.parse(tel:555-
2368));
• startActivity(call)
• Activities mapped to intent with Intent filters in the manifext
xml-file
• You can provide your own replacements even to platform’s
own intent handlers, e.g. Dialer
• Promotes loose coupling
Date, time, etc.
Broadcast receivers
• Used to listen to events sent by activities or services
• Declared in the manifest as Intent Filter
• Extend BroadcastReceiver
Date, time, etc.
User interface
• Is composed of Views and ViewGroups
• Uses layouts
• Layouts are ViewGroups
• Lots of ready-made Views
• ListView, TextView, EditText, Buttons, all the usual suspects
• Also ready made components to include maps or a browser control
in to your application. OpenGL ES can be used as well.
• Easy to create custom Views
Date, time, etc.
User interface continued
• Declarative approach using XML preferred over in-code
• I18N and L10N is simple using XML resources
• ResourceManager matches with dir structure according to
precedence
• Drawable-fr
• Drawable-en-notouch
• Drawable-en-port-92dpi
• 9-Patch bitmaps
• No SVG support!
• Animations:
• Tweened, declared in XML
• Frame-by-frame
Date, time, etc.
Application data and security
• Underlying Linux user account created for each app
• Security based on app permissions
• Declarative permissions
• Signed by developer’s certificate
• User approves permissions when installing
• Applications are sandboxed
• Use Content providers to share data
• Store light weight preferences in app dir
• For more data SQLite
Date, time, etc.
Android Market
• Since October 2008
• Started with free apps only
• In February 2009 paid apps were introduced in UK and US
Markets.
• Payment via Google Checkout
• Paid apps available in 10 countries (not Finland)
• $25 registration fee for developers
• 70% to developer
• Price range: free - $200 (No I Am Rich apps)
• 24h money back guarantee!
• Ratings, upgrades, stats
Date, time, etc.
Thank you
Date, time, etc.
References
• Images courtesy of
• http://developer.android.com/
• http://bit.ly/JXX97