Google Android

Based on android-sdk_2.2

Mobile Computing

Bruce Scharlau, University of Aberdeen, 2010

Android is part of the µbuild a better phone¶ process
Open Handset Alliance produces Android Comprises handset manufacturers, software firms, mobile operators, and other manufactures and funding companies
http://www.openhandsetalliance.com/

Bruce Scharlau, University of Aberdeen, 2010

2010 .admob.pdf Bruce Scharlau.Android is growing Uneven distribution of OS by regions Does not include iTouch or iPad. as not smartphones http://metrics.com/wp-content/uploads/2010/06/May-2010-AdMob-Mobile-Metrics-Highlights. University of Aberdeen.

sort of« Bruce Scharlau.html .Android makes mobile Java easier Well. University of Aberdeen.com/android/goodies/index.google. 2010 http://code.

2010 } .Android applications are written in Java package com.google.layout.android. University of Aberdeen. public class HelloActivity extends Activity { public HelloActivity() { } @Override public void onCreate(Bundle icicle) { super. setContentView(R.helloactivity.os. import android.Bundle. } Bruce Scharlau. import android.onCreate(icicle).app.hello_activity).Activity.

University of Aberdeen.Android applications are compiled to Dalvik bytecode Write app in Java Compiled in Java Transformed to Dalvik bytecode Loaded into Dalvik VM Linux OS Bruce Scharlau. 2010 .

The Dalvik runtime is optimised for mobile applications Run multiple VMs efficiently Each app has its own VM Minimal memory footprint Bruce Scharlau. 2010 . University of Aberdeen.

University of Aberdeen. 2010 .Android has many components Bruce Scharlau.

html .com/resources/dashboard/platform-versions. University of Aberdeen.android.Can assume that most have android 2.2 Bruce Scharlau.1 or 2. 2010 http://developer.

University of Aberdeen. 2010 .Android has a working emulator Bruce Scharlau.

University of Aberdeen.All applications are written in Java and available to each other Android designed to enable reuse of components in other applications Each application can publish its capabilities which other apps can use Bruce Scharlau. 2010 .

text boxes. 2010 . providing access to noncode resources such as localized strings. and layout files Bruce Scharlau. grids. graphics. buttons. University of Aberdeen. or to share their own data An Activity Manager that manages the life cycle of applications and provides a common navigation backstack A Notification Manager that enables all apps to display custom alerts in the status bar A Resource Manager.Android applications have common structure Views such as lists. and even an embeddable web browser Content Providers that enable applications to access data from other applications (such as Contacts).

Android applications have common structure Broadcast receivers can trigger intents that start an application Data storage provide data for your apps. file. and trigger events Bruce Scharlau. 2010 . and the Views provide the UI to the activity Intents specify what specific action should be performed Services run in the background and have no UI for the user ± they will update data. University of Aberdeen. and can be shared between apps ± database. and shared preferences (hash map) used by group of applications Activity is the presentation layer of your app: there will be one per screen.

There is a common file structure for applications code files images UI layouts constants Autogenerated resource list Bruce Scharlau. University of Aberdeen. 2010 .

Standard components form building blocks for Android apps Notifications Has life-cycle Activity Views Intents screen App to handle content Service manifest Background app Like music player ContentProviders Bruce Scharlau. University of Aberdeen. 2010 Other applications .

android.MAIN"/> <category android:name="android. University of Aberdeen.com/apk/res/android" package="com.category.app.LAUNCHER"/> </intent-filter> </activity> </application> Bruce Scharlau.helloactivity"> <application android:label="@string/app_name"> <activity android:name=".my_domain. 2010 .HelloActivity"> <intent-filter> <action android:name="android.The AndroidManifest lists application details <?xml version="1.intent.intent.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.action.

2010 . University of Aberdeen.Activity is one thing you can do From fundamentals page in sdk Bruce Scharlau.

University of Aberdeen.Intent provides late running binding to other apps It can be thought of as the glue between activities. Written as action/data pairs such as: VIEW_ACTION/ACTION content://contacts/1 Bruce Scharlau. It is basically a passive data structure holding an abstract description of an action to be performed. 2010 .

Services declared in the manifest and provide support Services run in the background: Music player providing the music playing in an audio application Intensive background apps. 2010 . might need to spawn their own thread so as to not block the application Bruce Scharlau. University of Aberdeen.

2010 . or that your phone is ringing. University of Aberdeen.Notifications let you know of background events This way you know that an SMS arrived. and the MP3 player should pause Bruce Scharlau.

2010 .ContentProviders share data You need one if your application shares data with other applications This way you can share the contact list with the IM application If you don¶t need to share data. University of Aberdeen. then you can use SQLlite database Bruce Scharlau.

layout. University of Aberdeen.UI layouts are in Java and XML setContentView(R.hello_activity). 2010 . //will load the XML UI file Bruce Scharlau.

google.myapp" > <uses-permission id="android.app.RECEIVE_SMS" /> </manifest> Bruce Scharlau.com/apk/res/android" package="com. University of Aberdeen. 2010 .android.permission.android.Security in Android follows standard Linux guidelines Each application runs in its own process Process permissions are enforced at user and group IDs assigned to processes Finer grained permissions are then granted (revoked) per operations <manifest xmlns:android="http://schemas.

details ‡ There is http://www.org Bruce Scharlau. 2010 .blogspot. University of Aberdeen.com/ which has lots of useful examples. sample applications and lots of docs ‡ Blog http://android-developers.anddev.There are lots of sources of information ‡ The sdk comes with the API references.