Instructor for 1,000s of developers on Android at Qualcomm, Cisco, Motorola, DoD and other great orgs. Author of Learning Android published by O’Reilly. Speaker at OSCON (3x), ACM, IEEE, SDC, AnDevCon. Co-Founder of SFAndroid.org Co-Chair of Android Open conference: AndroidOpen.com
Inc. Work on Dalvik starts 2007 Open Handset Alliance announced Early SoOware Development Kit 2008-‐2010 Android becomes the dominant mobile plaTorm 2011 Games, Tablets, TVs Future? Beyond phones
a set of Google’s proprietary applications, such as Maps, Gmail, Gtalk, and many others. OEMs and carriers typically enter into a licensing agreement with Google in order to distribute Google version of Android.
Bionic, a super fast and small license-friendly libc library optimized for Android WebKit library for fast HTML rendering OpenGL for graphics Media codecs offer support for major audio/video codecs SQLite database Much more… Linux Kernel Libraries Application Framework Applications Home Contacts Phone Browser Other Activity Manager Window Manager Content Providers View System Package Manager Telephony Manager Resource Manager Location Manager Notiication Manager Surface Manager OpenGL SGL Media Framework FreeType SSL SQLite WebKit libc Android Runtime Core Libs Dalvik VM Display Driver Keypad Driver Camera Driver WiFi Driver Flash Driver Audio Driver Binder Driver Power Mgmt
Dalvik is optimized for mobile devices: • Battery consumption • CPU capabilities Key Dalvik differences: • Register-based versus stack-based VM • Dalvik runs .dex files • More efficient and compact implementation • Different set of Java libraries than JDK
in an intuitive Java API. This ecosystem that developers can easily tap into is what makes writing apps for Android easy. Location, web, telephony, WiFi, Bluetooth, notifications, media, camera, just to name a few. Linux Kernel Libraries Application Framework Applications Home Contacts Phone Browser Other Activity Manager Window Manager Content Providers View System Package Manager Telephony Manager Resource Manager Location Manager Notiication Manager Surface Manager OpenGL SGL Media Framework FreeType SSL SQLite WebKit libc Android Runtime Core Libs Dalvik VM Display Driver Keypad Driver Camera Driver WiFi Driver Flash Driver Audio Driver Binder Driver Power Mgmt
and play it. VideoView is a View that you can drop anywhere in your activity, point to a video file and play it. XML: <VideoView android:id="@+id/video" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center” /> Java: player = (VideoView) findViewById(R.id.video); player.setVideoPath("/sdcard/samplevideo.3gp"); player.start();
HE-‐ AACv2, AMR-‐NB, AMR-‐WB, MP3, MIDI, RTTTL/RTX, Ogg, PCM/WAVE Video H.263, H.264, MPEG-‐4, VP8 Image JPEG, GIF, PNG, BMP RTSP and HTTP progressive streaming. HTTP live streaming coming soon. More native support in the works. Native support available via Khronos OpenMax IL
Administrator can set: Enable passwords Set password quality Max failed logins Prompt for new password Remotely wipe device data Lock the device App requests Device Admin permissions. If granted, admin policies apply. If not, app doesn’t work. Policies could be hard-coded or dynamic. Third-party enterprise solutions use this framework to build DM policies.
points. One for system, one for the apps, and one for whatever. Each app has its own sandbox easily accessible to it. No one else can access its data. The sandbox is in /data/data/com.marakana.yamba/ SDCard is expected to always be there. It’s a good place for large files, such as movies and music. Everyone can access it. System partition is where the entire Android operating system is, customized by OEM or not.
a new Android project. Here are some key constructs: Project Eclipse construct Target minimum to run App name whatever Package Java package Ac<vity Java class
much simpler than activity’s. An activity typically starts and stops a service to do some work for it in the background, such as play music, check for new tweets, etc. Services can be bound or unbound.
collection of many different building blocks. They are loosely coupled and can be reconfigured by the developer easily, or at least that’s the intention. Let’s look at 7 stages of Yamba next.
Java code Similar to Swing or AWT You write XML code Similar to HTML of a web page You can mix and match both styles. Best practice: • Start with XML and declare most of UI • Switch to Java and implement the UI logic
and play it. VideoView is a View that you can drop anywhere in your activity, point to a video file and play it. XML: <VideoView android:id="@+id/video" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center” /> Java: player = (VideoView) findViewById(R.id.video); player.setVideoPath("/sdcard/samplevideo.3gp"); player.start();
is going on in your app. Can be viewed via command line or Eclipse. Logs can be generated both from SDK Java code, or low-level C code via Bionic libc extension.
user, or OS Cannot read/write user’s private data Cannot read other app’s data Cannot perform network access Cannot keep device awake, and so on Each application is its own sandbox To share resources, apps need to request permissions User must grant permissions at install time Linux manages security Not up to Dalvik (Java) but outsourced to Linux Native code (NDK) also adheres to sandboxing
own. It contains any number of Activities, Services, Receivers and Providers. It has its own file system, database, place to store native libraries. No other app can access any of its data without prior permission.
require callers to have permission to access it. App that wants to use it must have user grant it permission. Permissions are granted at install time. All or nothing. Forever.
development. It is based on Java and augmented with XML. It takes about 3-5 days of intensive training to learn Android application development for someone who has basic Java (or similar) experience. Marko Gargenta, Marakana.com [email protected] +1-415-647-7000