4.
What is Android?• Android is an open-source software platform created by Google and the Open Handset Alliance.• It is primarily used to power mobile phones.• It has the capability to make inroads in many other (non-phone) embedded application markets. 4

5.
What is Android?• Android™ consists of a complete set of software components for mobile devices including: – an operating system, – middleware, and – embedded key mobile applications – a large market. 5

7.
What is Open Handset Alliance?• Quoting from www.OpenHandsetAlliance.com page• “… Open Handset Alliance™, a group of 47 technology and mobile companies have come together to accelerate innovation in mobile and offer consumers a richer, less expensive, and better mobile experience.• Together we have developed Android™, the first complete, open, and free mobile platform.• We are committed to commercially deploy handsets and services using the Android Platform. “ 7

16.
Android Components (Stack)• The Android stack includes a large array of features for mobile applications.• It would be easy to confuse Android with a general purpose computing environment.• All of the major components of a computing platform are included. 16

24.
Why use Linux for a phone?• Linux kernel is a proven core platform.• Reliability is more important than performance when it comes to a mobile phone, because voice communication is the primary use of a phone.• Linux provides a hardware abstraction layer, letting the upper levels remain unchanged despite changes in the underlying hardware.• As new accessories appear on the market, drivers can be written at the Linux level to provide support, just as on other Linux platforms. 24

34.
Example of Intent (1)• Following fragments calls an Intent whose job is to invoke a built-in task (ACTION_VIEW) and explore the Contacts available in the phone. Intent myIntent = new Intent( Intent.ACTION_VIEW, Uri.parse("content://contacts/people")); startActivity(myIntent); 34

56.
Android Broadcast ReceiverType of BroadcastsThere are two major classes of broadcasts that can be received:• Normal broadcasts (sent with sendBroadcast) are completely asynchronous. All receivers of the broadcast are run in an undefined order, often at the same time. This is more efficient, but means that receivers cannot use the result or abort APIs included here.• Ordered broadcasts (sent with sendOrderedBroadcast) are delivered to one receiver at a time. As each receiver executes in turn, it can propagate a result to the next receiver, or it can completely abort the broadcast so that it wont be passed to other receivers. The order receivers run in can be controlled with the android:priority attribute of the matching intent-filter; receivers with the same priority will be run in an arbitrary order. 56

57.
Android Broadcast ReceiverBroadcast Receiver Life Cycle• A process that is currently executing a BroadcastReceiver (that is, currently running the code in its onReceive(Context, Intent) method) is considered to be a foreground process and will be kept running by the system except under cases of extreme memory pressure.• Once you return from onReceive(), the BroadcastReceiver is no longer active, and its hosting process is only as important as any other application components that are running in it.• This means that for longer-running operations you will often use a Service in conjunction with a BroadcastReceiver to keep the containing process active for the entire time of your operation. 57

66.
Android Content ProviderThe data model• Content providers expose their data as a simple table on a database model, where each row is a record and each column is data of a particular type and meaning.• For example, information about people and their phone numbers might be exposed as follows: 66

67.
Android Content ProviderURIs• Each content provider exposes a public URI that uniquely identifies its data set.• A content provider that controls multiple data sets (multiple tables) exposes a separate URI for each one.• All URIs for providers begin with the string "content://".• Android defines CONTENT_URI constants for all the providers that come with the platform. For example – android.provider.Contacts.Phones.CONTENT_URI android.provider.Contacts.Photos.CONTENT_URI – android.provider.CallLog.Calls.CONTENT_URI android.provider.Calendar.CONTENT_URI• The ContentResolver method takes an URI as its first argument. Its what identifies which provider the ContentResolver should talk to and which table of the provider is being targeted. 67

68.
Android Content ProviderQuerying a Content Provider• You need three pieces of information to query a content provider: – The URI that identifies the provider – The names of the data fields you want to receive – The data types for those fields• If youre querying a particular record, you also need the ID for that record.• A query returns a Cursor object that can move from record to record and column to column to read the contents of each field. It has specialized methods for reading each type of data. 68

71.
Android Manifest xml File• Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory.• The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the applications code. 71