Android Architecture App Components Lecture Outcomes After end

  • Slides: 24
Download presentation
Android Architecture & App Components

Android Architecture & App Components

Lecture Outcomes After end of this lecture you will be able to; • Understand

Lecture Outcomes After end of this lecture you will be able to; • Understand Android architecture. • Understand Android application components.

Android Architecture Android operating system is a stack of software components which is roughly

Android Architecture Android operating system is a stack of software components which is roughly divided into five sections § Linux Kernel § Android Libraries § Android Runtime § Application framework § Applications These components are arranged in four main layers as shown in the architecture diagram.

APPLICATIONS Home Contact Phone Browser … APPLICATION FRAMEWORK Activity Manager Window Manager Content Provider

APPLICATIONS Home Contact Phone Browser … APPLICATION FRAMEWORK Activity Manager Window Manager Content Provider View System Notification Manager Package Manager Telephony Manager Resource Manager Location Manager XMPP Service LIBRARIES ANDROID RUNTIME Surface Manager Media Framework SQLite Core Libraries Open. GL Free Type Web. Kit DVM / ART SGL SSL libc LINUX KERNEL Display Diver Camera Driver Flash Memory Driver Binder (IPC) Driver Bluetooth Driver Keypad Driver Wi-Fi Driver Audio Driver Power Management USB Driver Fig. Android Architecture

Android Architecture Linux kernel • At the bottom of the layers is Linux kernel.

Android Architecture Linux kernel • At the bottom of the layers is Linux kernel. • Variant of GNU Linux OS kernel, Android Linux kernel. LINUX KERNEL Display Diver Camera Driver Flash Memory Driver Binder (IPC) Driver Bluetooth Driver Keypad Driver Wi-Fi Driver Audio Driver Power Management USB Driver

Android Architecture Android Linux kernel • Written in C and ships separately from rest

Android Architecture Android Linux kernel • Written in C and ships separately from rest of the Android stack. • Optimized to meet the needs of mobile devices and apps. • Shields higher Android layers from hardware diversity. • Mediates access to and sharing hardware resources. • Also extends GNU Linux for conserve shared memory, manage power and accelerate communication between classes. • Android Linux kernel is forked version of GNU Linux therefore it is not entirely compatible with GNU Linux.

Android Architecture Libraries • A set of libraries including open-source Web browser engine Web.

Android Architecture Libraries • A set of libraries including open-source Web browser engine Web. Kit. LIBRARIES Surface Manager Media Framework SQLite Open. GL Free Type Web. Kit SGL SSL libc • Well known library libc, • SQLite database which is a useful repository for storage and sharing of application data, • Libraries to play and record audio and video, • SSL libraries responsible for Internet security etc

Android Architecture Android Libraries Java-based libraries that are specific to Android development. Android libraries

Android Architecture Android Libraries Java-based libraries that are specific to Android development. Android libraries available to the Android developer is as follows Android. app − Provides access to the application model android. content − Facilitates content access, publishing and messaging between applications and application components. android. database − Used to access data published by content providers and includes SQLite database management classes. android. opengl − A Java interface to the Open. GL ES 3 D graphics rendering API.

Android Architecture android. os − Provides applications with access to standard operating system services

Android Architecture android. os − Provides applications with access to standard operating system services including messages, system services and inter-process communication. android. text − Used to render and manipulate text on a device display. android. view − The fundamental building blocks of application user interfaces. android. widget − A rich collection of pre-built user interface components such as buttons, labels, list views, layout managers, radio buttons etc. android. webkit − A set of classes intended to allow webbrowsing capabilities to be built into applications.

Android Architecture Android Runtime This section provides a key component called Dalvik Virtual Machine.

Android Architecture Android Runtime This section provides a key component called Dalvik Virtual Machine. ANDROID RUNTIME Core Libraries DVM / ART

Android Architecture • The Dalvik VM makes use of Linux core features like memory

Android Architecture • The Dalvik VM makes use of Linux core features like memory management and multi-threading, which is intrinsic in the Java language. • The Dalvik VM enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine. The Android runtime also provides a set of core libraries which enable Android application developers to write Android applications using standard Java programming language.

Android Architecture APPLICATION FRAMEWORK Activity Manager Window Manager Content Provider View System Notification Manager

Android Architecture APPLICATION FRAMEWORK Activity Manager Window Manager Content Provider View System Notification Manager Package Manager Telephony Manager Resource Manager Location Manager XMPP Service Application Framework • Contains system services that provides apps with the capabilities and info they need to do their job. • These services run continuously during system operation. • Control flow driven by various events and callbacks. • Application developers can make use of these services in their applications.

Android Architecture The Android framework includes the following key services, Activity Manager − Controls

Android Architecture The Android framework includes the following key services, Activity Manager − Controls all aspects of the application lifecycle and activity stack. Content Providers − Allows applications to publish and share data with other applications. Resource Manager − Provides access to non-code embedded resources such as strings, color settings and user interface layouts. Notifications Manager − Allows applications to display alerts and notifications to the user. View System − An extensible set of views used to create application user interfaces.

Android Architecture APPLICATIONS Home Contact Phone Browser Calendar Maps Mail Gallery FM … Applications

Android Architecture APPLICATIONS Home Contact Phone Browser Calendar Maps Mail Gallery FM … Applications • All the Android application that we use everyday are at the top layer. • One can write application to be installed on this layer only. Examples of such applications are Contacts, Browser, Games etc.

APPLICATIONS Home Contact Phone Browser … APPLICATION FRAMEWORK Written in Java Activity Manager Window

APPLICATIONS Home Contact Phone Browser … APPLICATION FRAMEWORK Written in Java Activity Manager Window Manager Content Provider View System Notification Manager Package Manager Telephony Manager Resource Manager Location Manager XMPP Service ANDROID LIBRARIES Surface Manager Media Framework Open. GL Free Type SGL SSL ANDROID RUNTIME SQLite Core Libraries Written in C++ (NDK) Web. Kit DVM / ART libc LINUX KERNEL Display Diver Camera Driver Flash Memory Driver Written in C Binder (IPC) Driver Bluetooth Driver Keypad Driver Wi-Fi Driver Audio Driver Power Management USB Driver

Android Application Components • Application components are the essential building blocks of mobile apps.

Android Application Components • Application components are the essential building blocks of mobile apps. • These components are loosely coupled by the application manifest file Android. Manifest. xml that describes each component of the application and how they interact. There are 4 main components Activity Broadcast Receiver Service Content Provider

Android Application Components Intents • Are the messages that describes an action to perform

Android Application Components Intents • Are the messages that describes an action to perform or an event that was occurred. Service Activity t n nte I Broadcast Receiver Content Provider

Android Application Components Activity • Most common type of Android component. • It’s heart

Android Application Components Activity • Most common type of Android component. • It’s heart of all Android Apps. • An activity represents a single screen with a user interface, inshort Activity defines user facing operations that displayed on device screen. • For example, an email application might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails. • If an application has more than one activity, then one of them should be marked as the activity that is presented when the application is launched.

Android Application Components Services • A service is a component that runs in the

Android Application Components Services • A service is a component that runs in the background to perform long-running operations. • Also use to accesses remote resources. • For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity.

Android Application Components Broadcast Receivers • Part of intents framework enables component to respond

Android Application Components Broadcast Receivers • Part of intents framework enables component to respond to system wide event broadcast. • Broadcast Receivers simply respond to broadcast messages from other applications or from the system. • For example, applications can also initiate broadcasts to let other applications know that some data has been downloaded to the device and is available for them to use, so this is broadcast receiver who will intercept this communication and will initiate appropriate action.

Android Application Components Content Providers • Manages access to a central repository of structured

Android Application Components Content Providers • Manages access to a central repository of structured data. • Supports database “CRUD” operations. • A content provider component supplies data from one application to others on request. • Such requests are handled by the methods of the Content. Resolver class. • The data may be stored in the file system, the database or somewhere else entirely.

Additional Components There additional components which will be used in the construction of above

Additional Components There additional components which will be used in the construction of above mentioned entities, their logic, and wiring between them Fragments Represents a portion of user interface in an Activity. Views UI elements that are drawn on-screen including buttons, lists forms etc. Layouts View hierarchies that control screen format and appearance of the views.

Additional Components Resources External elements, such as strings, constants and drawable pictures. Manifest Configuration

Additional Components Resources External elements, such as strings, constants and drawable pictures. Manifest Configuration file for the application. Intents Messages wiring components together.

Thank you

Thank you