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

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

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

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

2010 .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. University of Aberdeen.

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

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

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

Android has a working emulator Bruce Scharlau. 2010 . 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 . 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. and even an embeddable web browser Content Providers that enable applications to access data from other applications (such as Contacts). providing access to noncode resources such as localized strings. text boxes. and layout files Bruce Scharlau. buttons. 2010 .Android applications have common structure Views such as lists. University of Aberdeen. graphics. grids.

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. 2010 .Android applications have common structure Broadcast receivers can trigger intents that start an application Data storage provide data for your apps. and shared preferences (hash map) used by group of applications Activity is the presentation layer of your app: there will be one per screen. and trigger events Bruce Scharlau. file. and can be shared between apps – database.

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

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

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

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

University of Aberdeen. It is basically a passive data structure holding an abstract description of an action to be performed.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. 2010 .

might need to spawn their own thread so as to not block the application Bruce Scharlau. University of Aberdeen.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 .

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

then you can use SQLlite database Bruce Scharlau. 2010 . University of Aberdeen.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.

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

2010 .permission.com/apk/res/android" package="com.myapp" > <uses-permission id="android.google.android.RECEIVE_SMS" /> </manifest> Bruce Scharlau.app.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.android. University of Aberdeen.

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

Sign up to vote on this title
UsefulNot useful