Android- Introduction for Beginners

27
DEVELOPMENT OF ANDROID-A journey Of TECH -Tripti Tiwari

description

Learn Basics of Android

Transcript of Android- Introduction for Beginners

Page 1: Android- Introduction for Beginners

DEVELOPMENT OF ANDROID-A journey

Of TECH

-Tripti Tiwari

Page 2: Android- Introduction for Beginners

Android Introduction

Page 3: Android- Introduction for Beginners

Open Handset AllianceGoogle and 33 other companies announced the

formation of the Open Handset Alliance on November 5, 2007.

This alliance shares a common goal of innovation on mobile devices.

Providing developers a new level of openness that enables them to work more collaboratively.

Page 4: Android- Introduction for Beginners

What is Android?

• Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.

• Android (robot), designed to resemble a human

Or

• An android is a robot or synthetic organism designed to look and act like a human, and with a body having a flesh-like resemblance.

Page 5: Android- Introduction for Beginners

Features AndroidApplication framework enabling reuse and replacement of

componentsDalvik virtual machine optimized for mobile devicesIntegrated browser based on the open source WebKit engine Optimized graphics powered by a custom 2D graphics

library); 3D graphics based on the OpenGL (Open Graphics Library ES 1.0 specification (hardware acceleration optional)

SQLite for structured data storageMedia support for common audio, video, and still image

formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)GSM Telephony (hardware dependent)Bluetooth, EDGE(Enhanced Data rates for GSM Evolution),

3G, and WiFi (hardware dependent)Camera, GPS, compass, and accelerometer (hardware

dependent)Rich development environment including a device emulator,

tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

Page 6: Android- Introduction for Beginners

Android Architecture

Page 7: Android- Introduction for Beginners

Application Framework

Developers are free to take advantage of the device hardware, access location information, run background services, set alarms, add notifications to the status bar, and much, much more.

Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework).

Page 8: Android- Introduction for Beginners

Underlying all applications is a set of services and systems, including:

A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser

Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data

A Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files

A Notification Manager that enables all applications to display custom alerts in the status bar

An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack

Page 9: Android- Introduction for Beginners

Libraries

• System C library

• Media Libraries

• Surface Manager

• LibWebCore

• SGL

• 3D libraries

• FreeType

• SQLite

Page 10: Android- Introduction for Beginners

Android Runtime

• Also sitting on top of the kernel is the Android runtime, including the Dalvik virtual machine and the core Java libraries.

• The Dalvik VM is Google’s implementation of Java, optimized for mobile devices. All the code you write for Android will be written in Java and

run within the VM.

Page 11: Android- Introduction for Beginners
Page 12: Android- Introduction for Beginners
Page 13: Android- Introduction for Beginners

Dalvik Virtual Machine

Dalvik is a virtual machine (VM) designed and written by DanBornstein at Google. Your code gets compiled into machine-independent instructions called bytecodes, which are thenexecuted by the Dalvik VM on the mobile device.Although the bytecode formats are a little different, Dalvik isessentially a Java virtual machine optimized for low memoryrequirements. It allows multiple VM instances to run at once andtakes advantage of the underlying operating system (Linux) forsecurity and process isolation.

Bornstein named Dalvik after a fishing village in Iceland wheresome of his ancestors lived.

Page 14: Android- Introduction for Beginners

Differences to a normal JavaVM

JavaVM’s one can find on almost any desktop computer nowadays are Stack-based Virtual Machines (VM).The DalvikVM on the other hand is register based, because on mobile-

processors are optimized for register-based execution .

Register-based VMs allow faster execution .

Page 15: Android- Introduction for Beginners

Linux Kernal• Android relies on Linux version 2.6 for core

system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.

Page 16: Android- Introduction for Beginners

Android Service Lifecycle

Page 17: Android- Introduction for Beginners
Page 19: Android- Introduction for Beginners

Activities

• As mentioned, Activities are classes that provide an interface. An Activity is given a window in which to add User Interface to. Therefore, creating multi-screen applications involves creating multiple Activities and transitioning between them.

• The Activity class inherits from the abstract Context class.

Page 20: Android- Introduction for Beginners

Context

Context is the closest Android gets to a reference to the current application and provides a mechanism for accessing the Android system. A Context is needed to perform many operations in Android such as:

• Accessing Android services

• Accessing preferences

• Creating views

• Accessing Device Resources

Page 21: Android- Introduction for Beginners

Intents

• Intents are used throughout Android to make things happen by sending messages. Intents are most commonly used within applications to launch Activities. To launch a new Activity, we create a new Intent, set the Context and the Activity class to launch and then tell the OS to handle the Intent, which launches the Activity.

Page 22: Android- Introduction for Beginners

loosely coupled applications

• Intents are a powerful concept as they allow the creation of loosely coupled applications. Intents can be used to communicate between any installed application component on the device.

• An Intent object can contain information for the receiving component. For example if your application calls via an Intent a browser it may send the URL to the browser component. An Intent also contain information for the Android system so that the Android system can determine which component should handle the request.

Page 23: Android- Introduction for Beginners
Page 24: Android- Introduction for Beginners

AndroidManifest.xml

Every Android application needs to include a file called AndroidManifest.xml. This file contains information about the application such as:

• Component Registration - The components that make up the app, including registration of Activities and Intents.

• Required Permissions - The permissions the app requires.

• OS Version Compatibility - The minimum Android API level the application supports.

Page 25: Android- Introduction for Beginners

Service

• A Service is code that is long-lived and runs without a UI. A good example of this is a media player playing songs from a play list.

Page 26: Android- Introduction for Beginners

Content Provider

• Applications can store their data in files, a SQLite database, preferences or any other mechanism that makes sense. A content provider, however, is useful if you want your application's data to be shared with other applications. A content provider is a class that implements a standard set of methods to let other applications store and retrieve the type of data that is handled by that content provider.

Page 27: Android- Introduction for Beginners