59
Android Introduction to Android

Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Embed Size (px)

Citation preview

Page 1: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android

Introduction to Android

Page 2: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Mobile application development

• Mobile application development is the process by which application software is developed for small low-power handheld devices such as personal digital assistants, enterprise digital assistants or mobile phones. These applications are either pre-installed on phones during manufacturing, or downloaded by customers from various mobile software distribution platforms

Page 3: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Execution Enviornment

• Android• Ios(Xcode is the development environment for the iOS SDK. )• BlackBerry(Third-party developers can write software using

the available BlackBerry classes,)• HP webOS• Symbian OS.(February 11, 2011, Nokia announced that it

would migrate away from Symbian to Windows Phone 7, Symbian platform was created by merging and integrating software assets contributed by Nokia, NTT DoCoMo, Sony Ericsson and Symbian Ltd).

• Windows Mobile

Page 4: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

• Continued :Android, Blackberry and J2ME uses Java Language for

their development but their applications are not portable because of different hardware, SDK and API. Windows Phone 7 requires Windows Operating system for its development, the Visual Studio (only supported IDE for Windows Phone) and Emulator also works only in Windows environment. C# is the language of Windows Phone 7 which is not used by any other platform. iPhone requires Macintosh Operating System and XCode is the IDE for iPhone. Objective C is used for the development of iOS

Page 5: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed
Page 6: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android

• Android is an open source software stack that includes the operating system,middleware and the key mobile applications along with a set of API libraries.

Page 7: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android• A free open source operating system for mobile

devices• An open source development platform for

creating mobile applications.

• Devices, particularly mobile phones, that run the android operating system and the applications created for it.

Page 8: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

What is Android• A software platform and operating system for mobile devices

• Based on the Linux kernel

• Developed by Google and later the Open Handset Alliance (OHA)

• Allows writing managed code in the Java language

• Possibility to write applications in other languages and compiling it to ARM native code (support of Google? No)

• Unveiling of the Android platform was announced on 5 November 2007 with the founding of OHA

Page 9: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Introduction

• Android is an operating system based on Linux with a Java programming interface.

• The Android Software Development Kit (Android SDK) provides all necessary tools to develop Android applications. This includes a compiler, debugger and a device emulator, as well as its own virtual machine to run Android programs.

• Android is officially guided by the Open Handset Alliance. In reality Google leads the project.

• Android allows background processing, provides a rich user interface library, supports 2-D and 3-D graphics using the OpenGL libraries, access to the file system and provides an embedded SQLite database.

Page 10: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Open handset alliance• A commitment to openness, a shared vision for the future, and concrete

plans to make the vision a reality.

• Welcome to the Open Handset Alliance™, a group of 84 technology and mobile companies who 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.

Page 11: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

introduction• What is the Open Handset Alliance (OHA)?

It's a consortium of several companies

Page 12: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

History of Android• 2005 Google buys Android, Inc. The world thinks a "gPhone" is about

to come out…• Everything goes quiet for a while.• 2007 Open Handset Alliance is announced. Android is officially open-

sourced.• 2008 Android SDK 1.0 is released. The G1 phone, manufactured by

HTC, and sold by the wireless carrier T-Mobile USA, follows shortly afterwards.

• 2009 sees a proliferation of Android-based devices. New versions of the operating system: Cupcake (1.5), Donut (1.6), and Eclair (2.0 and 2.1) are released. 20+ devices run Android.

• 2010 Android is 2nd only to RIM as best-selling smart phone platform. Froyo (Android 2.2) is released and so are 60+ devices that run it.

Page 13: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

What a Desserts (:-

Page 14: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android SDK Features

Page 15: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android SDK features• The true appeal of Android as a development enviornment lies in the

APIs It provides.1. No licensing,distribution or development fees or release approval

processes2. Wi-fi hardware access3. GSM,EDGE and 3G netoworks for telephony or data transfer

enabling you to make or receive the calls or SMS messages or to send or retrieve data across mobile networks.

4. Comprehensive API for location based services such as GPS5. Full multimedia hardware control ,including playback and recording

with the camera and microphone6. APIs for using sensor hardware,including accelometers and the

compass7. Libraries for using the Bluetooth for peer to peer data transfer.8. IPC message passing9. Shared data store

Page 16: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

• Continued10. Backgroun applications and processes

11. An integrated open source HTML5 web kit based browser12. Full support for applications that integrate map controls

as part of their user interface13. Support for 2D and 3D graphics.14. Media libraries for playing and recording a variety of

audio/video or still image formats15. Localization through a dynamic resource framework16. An application framework the encourages reuse of

application compnents and the replacement of native applications.

Page 17: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Access to hardware ,including camera ,GPS and Accelerometer(SDK FEATURES )

• The android SDK includes APIs for location based hardware(such as GPS),the camera,audio,network connections,wi-fi ,bluetooth,accelometers , touchscreen and power management.

Page 18: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Background services(Features)• Android supports applications and services

designed to run invisibly in the backgroun.• Background services make it possible to create

invisible application component that perform automatic processing without direct user interaction,Backgound execution allows your applications to become event driven and to support regular updates,which is perfect for market prices,gererating location-based alertsor prioritizing and prescreening incoming calls and sms messages

Page 19: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

SQLite Database for Data Storage and Retreival(Features)

• Android provides a lightweight relational database for each application using SQLite,your application can take advantage of this managed relational database engine to store data securely and efficiently.

• By default each application database is sandbox,its contents is available only to the application that created it -----but content providers supply a mechanizm for the managed sharing of these application databases.

Page 20: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Share Data and interapplication communication(Features)

• Android include three techniques for transmitting information from your application for use elsewhere----Notifications,Intents,and content providers.

Page 21: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android Applications

Page 22: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Native Android Applications• An e-mail client• An SMS management application• A full PIM (personal information management)suite

including a calendar and contacts lists • A Webkit-based web browser• A music player and picture gallery• A camera and video recording applications• A calculator• The home screen• An Alarrm clock

Page 23: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

• Android is designed to support a large variety of hardware platforms,from WVGA phones with hard keyboards to QVGA devices with resistive touchscreens

Page 24: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Proprietary Android Applicatiosn

• Android Market Client:-for downloading third-party Android applicatiosn.

• Google Maps:-application including street view,driving directions,satellite view and traffic conditions.

• Gmail mail Client• Google Talk instant-messaging client• YouTube video player.The open source nature of android means that carriers and OMEs can

customize the user interface and the applications bundled with each Android device,Several OEMs have done this ,icluding HTC with the Sense UI,Motorala with MotoBlur and sony Ericssons custom UI.

The look and feel of userinterface may vary,but your application will function in the same way across all compatible android devices (it means all compatible devices remains consistent across OEM and carrier varriation.

Page 25: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

First android phone(T-mobile G1)

Page 26: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android Application Development Process

Page 27: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

How mobile application runs

Page 28: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

The APK• An application is a single APK (application package) file. An APK

file roughly has three main components. It consists of all your Dalvik executable code (Java code compiled automatically to Dalvik executable) plus all your resources (everything that is not code, such as images, layouts, etc.). Additionally, it may contain some native code as well.

Dalvik executable: this is all your Java source code compiled down to Dalvik executable. This is the code that runs your application.

• Resources: resources are everything that is not code. Your application may contain number of images, audio/video clips, as well as numerous XML files describing layouts, language packs, and so on. Collectively, these items are resources.

• Native libraries: optionally, your application may include some native code, such as C/C++ libraries. These libraries could be packaged together with your APK file.

Page 29: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Intro to development framework

• Android applications are written with java as programing langurage but executed by a custeom virtual machine called Dalvik rather than by a java VM.

• Each android application runs in a separate process with in its own Dalvik instance ,relinquishing all responsibility for memory and process management to the Android run time,which stops and kills process as necessary to manage the resources

Page 30: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

continued• Dalvik and android run time sits at the top of

the linux kernel that handles the lowlevel hardware interaction,including the drivers and memory management ,while a set of APIs provides access to all the underlying services ,features and hardware.

Page 31: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

How to develop android applicationAndroid applications are primary written in the Java programming language. The

Java source files are converted to Java class files by the Java compiler. Android provides a tool dx which converts Java class files into a dex (Dalvik

Executable) file. All class files of one application are placed in one compressed .dex file. During this conversion process redundant information in the class files are optimized in the .dex file. For example if the same String in different class file is found, the .dex file is stored only once and reference this String in the corresponding classes.

.dex files are therefore much smaller in size then the corresponding class files. The .dex file and the resources of an Android project, e.g. the images and XML files

are packed into an .apk (Android Package) file. The program aapt (Android Asset Packaging Tool) perform this packaging.

The resulting .apk file contains all necessary data to run the Android application and can be deployed to an Android device via the "adb" tool.

The Android Development Tools (ADT) allows that all these steps are performed transparent to the user; either within Eclipse or via the command line.

If you use the ADT tooling you press a button or run a script and the whole Android application (.apk file) will be created and deployed.

Page 32: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Software Development Kit(SDK)

Page 33: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

SDK

• Android software development kit includes everything you need to start developing,testing,and debugging Android application,it includes

• Android APIs:-libraries that provide developer access to the Android Stack.These are the same libraries used at google to create native android applications

Page 34: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

• Development Tools:-so you can turn android source code into executable Android applications,the SDK includes several development tools that let you compile and debug your application.

• The Android Virtual Device Manager and Emulator:-All android application run with in the Dalvik VM.Full Documentation:-Sample codeOnline support

Page 35: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

SDK• SDK includes everything that you need to start

developing,testing and debuging android applications

• Android API’s:The core of SDK is android APIs libraries that provide developer access to the Android stack.

• Development tools:• The android virtual device manager and Emulator:FullDocumentation:SamplecodeOnline support

Page 36: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android Software Stack

Page 37: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed
Page 38: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Linux kernel

• provides abstraction between the hardware and the rest of the stack, responsible for device drivers (Camera , Wi Fi, etc…), resources management , power management, security and net working.

• There are many good reasons for choosing Linux as the base of the Android stack. Some of the main ones are portability, security, and features.

Page 39: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

C/C++ Libraries(native libraries)• Native libraries are C/C++ libraries often taken from the open source community

in order to provide necessary services to Android application layer. They include:

• WebKit: a fast web rendering engine used by Safari, Chrome, and other browsers

• SQLite: a full-featured SQL database• Apache Harmony: an open source implementation of Java• OpenGL: 3D graphics libraries• OpenSSL: the secure socket layer• and many others• While many of these libraries are taken as-is, one notable exception is Bionic.

Bionic is basically a rewritten version of Standard C Library. The reason for Bionic is two fold:

Technology: to make it purpose-built for tiny battery powered devicesLicense: to make it license-friendly to others who may want to adopt it and change

it

Page 40: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

The Android Runtime

• includes Core libraries and the Dalvik Vitual Machine.The Core libraries provide most of java libraries + additional Android libraries.The Dalvik VM provides (Just In Time) JIT compilation. the VM is optimized to run multiple instances of VMs. As Java applications access the core libraries each application has its own VM

Page 41: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

The Android Application Framework

• Provides classes required to develop an Android application and abstraction between hardware access. the Android Java API’s main library include telephony, content providers (data), resources, locations and UI.

Page 42: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

App frmework(continued)• The application framework is a rich environment that provides

numerous services to you, the app developer,. This is the part of the platform that is best documented and extensively covered. That is because it is this layer that enables the mass-market of developers to get creative and be empowered to create fantastic applications.

• In application framework layer, you will find numerous Java libraries specifically built for Android. You will also find many services (or managers) that provide the ecosystem of capabilities your application can tap into, such as location, sensors, WiFi, telephony and so on

• As you explore the Android application development, most of your focus will be on this part of the stack. You will get to use many of the application framework components yourself.

Page 43: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Application Layer

• all Android applications(native or third party) are built on the application layer using the same API.

• So Android applications are written in Java, but remember it is not Java ME (Mobile Edition). It’s just Most of J2SE libraries + Android’s own Java libraries.

Page 44: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android Application Architecture

Page 45: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android Application Architecture• Android architecture encourages component

reuse allowing you to publish and share activities, services and data between applications with security restrictions defined by you. This enables developers to include out of the box components such as the phone dialer or contact manager to their applications, or add new functionalities to them.

Page 46: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Application Architecture

• Activity Manager: which controls the life cycle of the activities, activities can be compared to the windows or web forms they carry the controls (views) that construct the interface, an activity represents a single screen.

Page 47: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Application Architecture

• Views: the UI components that construct the interface. They can be compared to the swing or windows forms controls

• Notification Manger: provides a consistent mechanism to notify or alert users.

• Content Providers: lets applications to share data between them.

• Resources Manager: much like the ASP.NET resources concept. Enables the developer to store resources such as strings or images.

Page 48: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Secutiy and permissions• During deployment on an Android device, the

Android system will create a unique user and group ID for every Android application. Each application file is private to this generated user, e.g. other applications cannot access these files.

• In addition each Android application will be started in its own process.

• Therefore by means of the underlying Linux operating system, every Android application is isolated from other running applications. A misbehaving application cannot easily harm other Android applications.

Page 49: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android Applications Security

Page 50: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Security and permissions• If data should be shared the application must do this

explicitly, e.g. via a Service or a ContentProvider. • Android also contains a permission system. Android

predefines permissions for certain tasks but every application can also define its own permissions.

• An application must declare in its configuration file (AndroidManifest.xml) that it requires certain permissions.

• Depending on the details of the defined permission, the Android system will during installation either automatically grant the permission, reject it or ask the user if he grants these permissions to the application.

Page 51: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Security and permissions• If for example the application declares that is requires Internet

access then the user need to confirm this during installation. • This is called "user driven security". The user decides to grant

a permission or to deny it. If the user does not want to give all permissions required by the application, this application cannot be installed. The check of the permission is only performed during installation, permissions cannot be denied or granted after the installation.

• Typically not all users check the permissions in detail but some users do and if there is something strange with them, they will write bad reviews on the corresponding Android markets.

Page 52: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Android Application Component

Page 53: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Important Android Compnents(Activity)1

• Activity represents the presentation layer of an Android application. A simplified (and slightly incorrect) description is that an Activity is a a screen which the user sees.. An Android application can have several activities and it can be switched between them during runtime of the application.

Page 54: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Important android components

• Views are user interface widgets, e.g. buttons or text fields. The base class for all Views is android.view.View. The layout of the Views is managed by subclasses of type android.view.ViewGroups. Views often have attributes which can be used to change their appearance and behavior.

Page 55: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Important android compnents(services)

• Services perform background tasks without providing an UI. They can notify the user via the notification framework in Android.

Page 56: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Important android compnents(ContentProvider)

• ContentProvider provides an structured interface to data. Via a ContentProvider your application can share data with other applications. Android contains an SQLite database which is frequently used in conjunction with a ContentProvider to persists the data of the ContentProvider.

Page 57: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Important android compnents(Intents• Intents are asynchronous messages which allow the

application to request functionality from other components of the Android systen, e.g. from Services or Activities. An application can call a component directly (explicit intent) or ask the Android system to evaluate registered components for a certain Intents (implicit intents). For example the application could implement sharing of data via an Intent and all components which allow sharing of data would be available for the user to select. Applications register themselves to an intent via an IntentFilter. Intents allow to combine loosely coupled components to perform certain tasks.

Page 58: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Important android compnents(BroadcastReceiver)

• BroadcastReceiver can be registered to receives system messages and Intents. BroadcastReceiver will get notified by the Android system if the specified situation happens. For example a BroadcastReceiver could get called once the system completed its boot process or if a phone call is received.

Page 59: Android Introduction to Android. Mobile application development Mobile application development is the process by which application software is developed

Important android compnents(widgets)• Widgets are interactive components which are

primary used on the Android homescreen. They typically display some kind of data and allow the user to perform actions via them. For example a Widget could display a short summary of new emails and if the user select a email it could start the email application with the selected email