Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 26

Introducing Android

ABSTRACT

The mobile development community is at a tipping point. Mobile users demand more choice, more opportunities to customize their phones, and more functionality. Mobile operators want to provide value-added content to their subscribers in a manageable and lucrative way. Mobile developers want the freedom to develop the powerful mobile applications users demand with minimal roadblocks to success. Finally, handset manufacturers want a stable, secure, and affordable platform to power their devices. Up until now single mobile platform has adequately addressed the needs of all the parties. Enter Android, which is a potential game-changer for the mobile development community. An innovative and open platform, Android is well positioned to address the growing needs of the mobile marketplace. This topic explains what Android is, how and why it was developed, and where the platform fits in to the established mobile marketplace.

Dept. of CSE

Dr. KVSRIT

-1-

Introducing Android

Introduction
What is Android? Android is a software platform and operating system for mobile devices, based on the Linux kernel, developed by Google and later the Open Handset Alliance. It allows developers to write managed code in the Java language, controlling the device via Google-developed Java libraries. Applications written in C and other languages can be compiled to ARM native code and run, but this development path is not officially supported by Google. The unveiling of the Android platform on 5 November 2007 was announced with the founding of the Open Handset Alliance, a consortium of 48 hardware, software, and telecom companies devoted to advancing open standards for mobile devices. Google released most of the Android code under the Apache license, a free-software and open source license. Android Platform Differences Android is hailed as the first complete, open, and free mobile platform. Complete: The designers took a comprehensive approach when they developed the Android platform.They began with a secure operating system and built a robust software framework on top that allows for rich application development opportunities. Open: The Android platform is provided through open source licensing. Developers have unprecedented access to the handset features when developing applications. Free: Android applications are free to develop.There are no licensing or royalty fees to develop on the platform. No required membership fees. No required testing fees. No required signing or certification fees.Android applications can be distributed and commercialized in a variety of ways. Android: A Next Generation Platform Although Android has many innovative features not available in existing mobile platforms, its designers also leveraged many tried-and-true approaches proven to work in the wireless world. Its true that many of

Dept. of CSE

Dr. KVSRIT

-2-

Introducing Android these features appear in existing proprietary platforms, but Android combines them in a free and open fashion, while simultaneously addressing many of the flaws on these competing platforms. The Android mascot is a little green robot, shown in Figure 1.6.Youll see this little guy (girl?) often used to depict Android-related materials. Android is the first in a new generation of mobile platforms, giving its platform developers a distinct edge on the competition. Androids designers examined the benefits and drawbacks of existing platforms and then incorporate their most successful features. At the same time, Androids designers avoided the mistakes others suffered in the past.

Figure 1.6 The Android mascot.


Dept. of CSE Dr. KVSRIT -3-

Introducing Android

What is The Open Handset Alliance? Open Handset Alliance, is a consortium of several companies which include Google, HTC, Intel, Motorola, Qualcomm, T-Mobile, Sprint Nextel and NVIDIA, ... These companies which aim to develop technologies that will significantly lower the cost of developing and distributing mobile devices and services. The Android platform is the first step in this direction -- a fully integrated mobile "software stack" that consists of an operating system, middleware, user-friendly interface and applications.

License Android is under version 2 of the Apache Software License (ASL). The Apache license allows manufacturers and mobile operators to innovate using the platform without the requirement to contribute those innovations back to the open source community.

Dept. of CSE

Dr. KVSRIT

-4-

Introducing Android

2 Platform 2.1 Hardware


First and foremost, Android is a software stack for mobile devices. This means that high on the list of priorities is the preservation of battery power and the efficient management of limited memory resources. There are five distinct layers to the Android system stack:

Dept. of CSE

Dr. KVSRIT

-5-

Introducing Android

The Acorn RISC Machine (ARM) Linux core forms the solid base upon which all the other layers stand. Linux is a proven technology that is highly reliable, and the ARM processor family is known for high performance on very low power requirements. The libraries provide the reusable and sharable low-level code for basic functions such as codecs software for coding and decoding digital sound and video functions for the presentation of rich graphics on a small displays, secure shell support for encrypted TCP/IP traffic into the cloud, as well as component support for Web browsing (WebKit), SQL database functionality (SQLite), and standard C library functionality you would expect in a Linux system. The Dalvik run-time byte-code interpreter, which strongly resembles the Java language byte-code interpreter, adds a few distinct features that uniquely define the security and power-preserving model of Android. Every application currently running, for example, has its own user ID and its own copy of the interpreter running to strictly separate processes for security and reliability. The Android application framework enables you to use and replace components as you see fit. These high-level Java classes are tightly integrated components that define the Android API. The Android core applications include the WebKit browser, Google calendar, Gmail, Maps application, SMS messenger, and a standard e-mail client, among others. Android applications are written in the Java programming language, and you can download many more from the Android market on the fly. Android is not a single piece of hardware; it's a complete, end-to-end software platform that can be adapted to work on any number of hardware configurations. Everything is there, from the bootloader all the way up to the applications. And with an Android device already on the market, it has proven that it has what it takes to truly compete in the mobile arena.

Dept. of CSE

Dr. KVSRIT

-6-

Introducing Android

2.2 Operating System(s)

Dept. of CSE

Dr. KVSRIT

-7-

Introducing Android

Android uses Linux for its device drivers, memory management, process management, and networking. However you will never be programming to this layer directly. The next level up contains the Android native libraries. They are all written in C/C++ internally, but youll be calling them through Java interfaces. In this layer you can find the

Dept. of CSE

Dr. KVSRIT

-8-

Introducing Android Surface Manager (for compositing windows), 2D and 3D graphics, Media codecs (MPEG-4, H.264, MP3, etc.), the SQL database (SQLite), and a native web browser engine (WebKit). Next is the Android runtime, including the Dalvik Virtual Machine. Dalvik runs dex files, which are converted at compile time from standard class and jar files. Dex files are more compact and efficient than class files, an important consideration for the limited memory and battery powered devices that Android targets. The core Java libraries are also part of the Android runtime. They are written in Java, as is everything above this layer. Here, Android provides a substantial subset of the Java 5 Standard Edition packages, including Collections, I/O, and so forth. The next level up is the Application Framework layer. Parts of this toolkit are provided by Google, and parts are extensions or services that you write. The most important component of the framework is the Activity Manager, which manages the life cycle of applications and a common back-stack for user navigation. Finally, the top layer is the Applications layer. Most of your code will live here, along side built-in applications such as the Phone and Web Browser

2.3 Security and Permissions


The integrity of the Android platform is maintained through a variety of security measures.

Dept. of CSE

Dr. KVSRIT

-9-

Introducing Android Applications as Operating System Users When an application is installed, the operating system creates a new user profile associated with the application. Each application runs as a different user, with its own private files on the file system, a user ID, and a secure operating environment. The application executes in its own process with its own instance of the Dalvik VM and under its own user ID on the operating system. Explicitly Defined Application Permissions To access shared resources on the system, Android applications register for the specific privileges they require. Some of these privileges enable the application to use phone functionality to make calls, access the network, and control the camera and other hardware sensors. Applications also require permission to access shared data containing private and personal information such as user preferences, users location, and contact information. Applications might also enforce their own permissions by declaring them for other applications to use.The application can declare any number of different permission types, such as read-only or read-write permissions, for finer control over the application. Limited Ad-Hoc Permissions Applications that act as content providers might want to provide some on-the-fly permissions to other applications for specific information they want to share openly. This is done using ad-hoc granting and revoking of access to specific resources using Uniform Resource Identifiers (URIs). URIs index specific data assets on the system, such as images and text. Here is an example of a URI that provides the phone numbers of all contacts: content://contacts/phones To understand how this permission process works, lets look at an example. Lets say weve got an application that keeps track of the users public and private birthday wish lists. If this application wanted to share its data with other applications, it could grant URI permissions for the public wish list, allowing another application permission to access this list without explicitly having to ask for it.

Dept. of CSE

Dr. KVSRIT

- 10 -

Introducing Android Application Signing for Trust Relationships All Android applications packages are signed with a certificate, so users know that the application is authentic.The private key for the certificate is held by the developer.This helps establish a trust relationship between the developer and the user. It also allows the developer to control which applications can grant access to one another on the system. No certificate authority is necessary; self-signed certificates are acceptable.

2.4 Performance
Devices hosting Android applications have limited capabilities. That's why code should be efficient, avoid all unnecessary memory allocations, method calls (it takes a lot of time) and so on. In order to make our applications working fast on a mobile device we need to leave

Dept. of CSE

Dr. KVSRIT

- 11 -

Introducing Android back some habits, good from OOP point of view. In a mobile device we are not able to make a full model of reality what we want to operate on. Few things to remember: avoid object instantiation - create objects only if it is really necessary, because it costs time and memory. More instances means more-frequent garbage collection what lowers user-experience (freezes). use native built-in methods - they're written in C/C++ what makes them faster about 10100 times than implemented JAVA code (loops etc.). However note that calling native method is more expensive then calling implemented one. virtual over interface - in conventional programming it is usual to declare variables as interfaces, i.e.: Map myMap1 = new HashMap(); It is not good for embedded applications. Calling a method from interfaces takes 2 times more time than in normal way: HashMap myMap2 = new HashMap();

static over virtual - declare methods static if they do not need access to the object's fields. It can be called faster, because it doesn't require a virtual method table indirection. It's also good practice, because you can tell from the method signature that calling the method can't alter the object's state. cache field lookups, because accessing object fields is lower than local variables. The same situation is with methods - i.e. by for-statements, you should cache size() method if it is possible:

Dept. of CSE

Dr. KVSRIT

- 12 -

Introducing Android

2.5 Future possibilities


Android sits alongside a new wave of mobile operating systems designed for increasingly powerful mobile hardware. Windows Mobile and Apples iPhone now provide a richer, simplified development environment for mobile applications. However, unlike Android, theyre built on proprietary operating systems that often prioritize native applications over

Dept. of CSE

Dr. KVSRIT

- 13 -

Introducing Android those created by third parties and restrict communication among applications and native phone data. Android offers new possibilities for mobile applications by offering an open development environment built on an open source Linux kernel. Hardware access is available to all applications through a series of API libraries, and application interaction, while carefully controlled, is fully supported. In Android, all applications have equal standing. Third-party and native Android applications are written using the same APIs and are executed on the same run time. Users can remove and replace any native application with a third-party developer alternative; even the dialer and home screens can be replaced. Google Android Sales to Overtake iPhone in 2012 The OHA is committed to make their vision a reality: to deploy the Android platform for every mobile operator, handset manufacturers and developers to build innovative devices Intel doesnt want to lose ownership of the netbook market, so they need to prepare for anything, including Android Fujitsu launched an initiative to offer consulting and engineering expertise to help run Android on embedded hardware, which aside from cellphones, mobile internet devices, and portable media players, could include GPS devices, thin-client computers and settop boxes. More Android devices are coming and some will push the envelope even further

3 Software Development
3.1 Development Requirements Developing an application on the Android platform requires the following: knowledge of programming in Java Dr. KVSRIT - 14 -

Dept. of CSE

Introducing Android knowledge of XML (optional but recommended) Android SDK (requires x86 OS like Windows, Linux, Mac; JDK version >=5) Eclipse IDE (at least version 3.3) with Android Development Tools (ADT) plug-in (optional but recommended) Android powered smartphone (optional for testing purposes)

Notice that JavaME and JavaSE applications arent runnable on Android as the class libraries as well as the generated bytecode are different. 3.2 IDE and Tools Android SDK Beside of the actual java class library the Android SDK (latest version 1.1r1) contains all the tools that are necessary to build an Android application. Typically every Android SDK version consists of:

Developer Tools

As already mentioned above the SDK comes with a bunch of tools that relieve the creation of an Android app. In the following only the most important tools are described: aapt - Android Asset Packaging Tool Creates *.apk-files which contain all the resources as well as the program itself. Those ZIP-format based files can be transferred to and installed on an Android phone or the emulator.

adb Android Debug Bridge The main purpose of this tool is to set up connections to a real Android device or an Android emulator instance in order to transfer and install (apk)-files on it. With adb the developer also has the possibility to remote control the devices shell.

Dept. of CSE

Dr. KVSRIT

- 15 -

Introducing Android

dx Dalvik Cross-Assembler The dx is used for merging and converting Java-StandardByteCode Classes (*.class) into one single binary file (*.dex) that can be executed by the Dalvik VM. These *.dex-files are subject to be put into an *.apk-file together with resource files.

ddms - Dalvik Debug Monitor Service This tool provides port-forwarding services, screen capture on the device, thread and heap information on the device, logcat, process and radio state information, incoming call and SMS spoofing, location data spoofing, and more.

Emulator and System Images The SDK also contains an emulator that is able to simulate almost all the functionality of an actual Android device. This is achieved by booting so called system images which represent the Android OS with the whole software stack of a real Android device. Documentation, Sample Code Of course the SDK also provides the developer with a comprehensive documentation which consists not only of an API reference but also of programming guidelines as well as detailed descriptions for the several tools. There are also a few code examples that will allow understanding the typical workflow of an Android application right away. IDE Support Although it is possible to develop Android apps with every modern IDE Google recommends doing so is by using the Eclipse IDE with a special plug-in called ADT (Android Development Tools). The ADT makes use of all the Dev Tools that come with the SDK and therefore supports and simplifies all the steps from assembling the classes over packaging and signing to running the final application on the emulator.

Dept. of CSE

Dr. KVSRIT

- 16 -

Introducing Android The ADT is not just speeding up the testing process but also relieves the developers work in terms of UI creation and application description. For that reason the ADT offers the developer graphical representations of what has otherwise have to be written in XML. No Distinctions Made Between Native and Third-Party Applications Unlike other mobile development platforms, there is no distinction between native applications and developer-created applications on the Android platform. Provided the application is granted the appropriate permissions, all applications have the same access to core libraries and the underlying hardware interfaces. Android handsets ship with a set of native applications such as a Web browser and contact manager. Third-party applications might integrate with these core applications and even extend them to provide a rich user experience.

3.3 Commonly Used Packages


With Android, mobile developers no longer have to reinvent the wheel. Instead, developers

Dept. of CSE

Dr. KVSRIT

- 17 -

Introducing Android use familiar class libraries exposed through Androids Java packages to perform common tasks such as graphics, database access, network access, secure communications, and utilities (such as XML parsing). The Android packages include support for Common user interface widgets (Buttons, Spin Controls,Text Input) User interface layout Secure networking and Web browsing features (SSL,WebKit) Structured storage and relational databases (SQLite) Powerful 2D and 3D graphics (SGL and OpenGL ES 1.0) Audio and visual media formats (MPEG4, MP3, Still Images) Access to optional hardware such as Location-Based Services (LBS),WiFi, and Bluetooth

3.4 Android Application Framework

Dept. of CSE

Dr. KVSRIT

- 18 -

Introducing Android The Android application framework provides everything necessary to implement your average application.The Android application lifecycle involves the following key components: Activities are functions the application performs. Groups of views define the applications layout. Intents inform the system about an applications plans. Services allow for background processing without user interaction. Notifications alert the user when something interesting happens.

Android Applications can interact with the operating system and underlying hardware using a collection of managers. Each manager is responsible for keeping the state of some underlying system service. For example, there is a Location Manager that facilitates interaction with the location-based services available on the handset.The ViewManager and WindowManager manage user interface fundamentals.

4 Overall Evaluation
Dept. of CSE Dr. KVSRIT - 19 -

Introducing Android

4.1 Advantages
There are a host of advantages that Googles Android will derive from being an open source software. Some of the advantages include: The ability for anyone to customize the Google Android platform will open up the applications playing field to small and new players who lack the financial muscle to negotiate with wireless carriers like AT&T and Orange. The consumer will benefit from having a wide range of mobile applications to choose from since the monopoly will be broken by Google Android. Although this will depend on the carrier, one will be able to customize a mobile phones using Google Android platform like never before, right down to the screen. Features like weather details, opening screen, live RSS feeds and even the icons on the opening screen will be able to be customized. In addition, as a result of many mobile phones carrying Google Android, companies will come up with such innovative products like the location aware services that will provide users with any information they might be in need of. This information could include knowing the location of a nearby convenience store or filling station. In addition the entertainment functionalities will be taken a notch higher by Google Android being able to offer online real time multiplayer games and hd games.

Dept. of CSE

Dr. KVSRIT

- 20 -

Introducing Android

ANDROID HD GAMES

Dept. of CSE

Dr. KVSRIT

- 21 -

Introducing Android

A Free Market for Applications


Android developers are free to choose any kind of revenue model they want. They can develop freeware, shareware, or trial-ware applications, ad-driven, and paid applications. Android was designed to fundamentally change the rules about what kind of wireless applications could be developed. In the past, developers faced many restrictions that had little to do with the application functionality or features: Store limitations on the number of competing applications of a given type Store limitations on pricing, revenue models, and royalties Operator unwillingness to provide applications for smaller demographics With Android, developers can write and successfully publish any kind of application they want. Developers can tailor applications to small demographics, instead of just large-scale money-making ones often insisted upon by mobile operators.Vertical market applications can be deployed to specific, targeted users. Because developers have a variety of application distribution mechanisms to choose from, they can pick the methods that work for them instead of being forced to play by others rules. Android developers can distribute their applications to users in a variety of ways. Google developed the Android Market ,a generic Android application store with a revenue-sharing model. Handango.com added Android applications to its existing catalogue using their billing models and revenue sharing model. Developers can come up with their own delivery and payment mechanisms. Mobile operators are still free to develop their own application stores and enforce their own rules, but it will no longer be the only opportunity developers have to distribute their applications.

Dept. of CSE

Dr. KVSRIT

- 22 -

Introducing Android

ANDROID MARKET

Dept. of CSE

Dr. KVSRIT

- 23 -

Introducing Android

4.2 Limitations
Bluetooth limitations Google Talk functions and only the simplest implementation of Bluetooth. It'll work with Bluetooth headsets but that's about it; no Bluetooth stereo, no contacts exchange, no modem pairing and no using wireless keyboards. Android uses a non-standard jvm: there is no guarantee that the same software will run on multiple devices Firefox Mobile isn't coming to Android because of Android Limitations Fennec won't play nice with Android Market because apps in Android Market need to be programmed with a custom form of Java to run on Android. Mozilla and the Fennec peeps won't have that and won't be releasing any form of Firefox until Google amends the limitation of Android Apps.

Dept. of CSE

Dr. KVSRIT

- 24 -

Introducing Android

4.3 Conclusion
Mobile software development has evolved over time. Android has emerged as a new mobile development platform, building on past successes and avoiding past failures of other platforms. Android was designed to empower the developer to write innovative applications. The platform is open source, with no up-front fees, and developers enjoy many benefits over other competing platforms. Now its time to dive deeper and start writing Android code, so you can evaluate what Android can do for you. In the next chapter, we configure the Android development environment and take a brief walk through the Android SDK. Android is open to all: industry, developers and users Participating in many of the successful open source projects Aims to be as easy to build for as the web. Google Android is stepping into the next level of Mobile Internet We can only hope that the next versions of Android have overcome the actual limitations and that the future possibilities became a reality.

Dept. of CSE

Dr. KVSRIT

- 25 -

Introducing Android
BIBLIOGRAPHY

Android Development http://developer.android.com Open Handset Alliance: http://www.openhandsetalliance.com http://groups.google.com/group/android-developers Forum for development questions (advanced) http://www.planetandroid.com Blogs and news from around the Android community http://pragprog.com/titles/eband <book> Hello, Android: Introducing Googles Mobile Development Platform

Dept. of CSE

Dr. KVSRIT

- 26 -

You might also like