The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.

Slides:



Advertisements
Similar presentations
Android Application Development A Tutorial Driven Course.
Advertisements

Google Android Introduction to Mobile Computing. Android is part of the build a better phone process Open Handset Alliance produces Android Comprises.
Application Fundamentals Android Development. Announcements Posting in D2L Tutorials.
Android 02: Activities David Meredith
The Android Activity Lifecycle. Slide 2 Introduction Working with the Android logging system Rotation and multiple layouts Understanding the Android activity.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Android 101 Application Fundamentals January 29, 2010.
Mobile Application Development
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
@2011 Mihail L. Sichitiu1 Android Introduction Application Fundamentals.
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Android Middleware Bo Pang
Chien-Chung Shen Manifest and Activity Chien-Chung Shen
Mobile Application Development with ANDROID Tejas Lagvankar UMBC 29 April 2009.
About me Yichuan Wang Android Basics Credit goes to Google and UMBC.
Introduction to Android Swapnil Pathak Advanced Malware Analysis Training Series.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
Software Architecture of Android Yaodong Bi, Ph.D. Department of Computing Sciences University of Scranton.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
ANDROID CONTENT PROVIDERS Peter Liu School of ICT, Seneca College.
01. Introduction to Android Prof. Oum Saokosal Master of Engineering in Information Systems, South Korea
Cosc 5/4730 Introduction: Threads, Android Activities, and MVC.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Data Storage: Part 4 (Content Providers). Content Providers Content providers allow the sharing of data between applications. Inter-process communication.
Rajab Davudov. Agenda Eclipse, ADT and Android SDK APK file Fundamentals – Activity – Service – Content Provider – Broadcast Receiver – Intent Hello World.
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit
Mobile Application Development using Android Lecture 2.
DUE Hello World on the Android Platform.
CS378 - Mobile Computing Intents.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
Android for Java Developers Denver Java Users Group Jan 11, Mike
Overview of Android Application Development
CS378 - Mobile Computing Intents. Allow us to use applications and components that are part of Android System – start activities – start services – deliver.
COMP 365 Android Development.  Every android application has a manifest file called AndroidManifest.xml  Found in the Project folder  Contains critical.
ANDROID L. Grewe Components  Java Standard Development Kit (JDK) (download) (latest version)  AndroidStudio.
Android Security Model that Provide a Base Operating System Presented: Hayder Abdulhameed.
Mobile Application Security on Android Originally presented by Jesse Burns at Black Hat
DKU-MUST Mobile ICT Education Center 10. Activity and Intent.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Android Programming Steve Ko Computer Sciences and Engineering University at Buffalo.
Lecture 2: Android Concepts
Lecture 6: Process and Threads Topics: Process, Threads, Worker Thread, Async Task Date: Mar 1, 2016.
Java & The Android Stack: A Security Analysis Pragati Ogal Rai Mobile Technology Evangelist PayPal, eBay Java.
Services. What is a Service? A Service is not a separate process. A Service is not a thread. A Service itself is actually very simple, providing two main.
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Putting together the AndroidManifest.xml file Creating multiple.
CS371m - Mobile Computing Intents 1. Allow us to use applications and components that are already part of Android System – start activities – start services.
Introduction to Android Programming
Android Application -Architecture.
Mobile Applications (Android Programming)
Android Content Providers & SQLite
Content Providers And Content Resolvers
Android 01: Fundamentals
Instructor: Mazhar Hussain
Android Runtime – Dalvik VM
MAD.
Activities and Intents
Android Mobile Application Development
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
The Android Activity Lifecycle
CMPE419 Mobile Application Development
Application Development A Tutorial Driven Course
HNDIT2417 Mobile Application Development
Emerging Platform#3 Android & Programming an App
Mobile Programming Dr. Mohsin Ali Memon.
Introduction to Android
CMPE419 Mobile Application Development
Presentation transcript:

The Ingredients of Android Applications

A simple application in a process In a classical programming environment, the OS would load the program code into a process and then start executing it. Major high-level concepts involved in programming for the Android platform

A Java application, running in a Java virtual machine, in a process To use a rich GUI system like Swing, start a UI system and then write callbacks to code that process events.

Android introduces a richer and more complex approach by supporting multiple application entry points. Starts them in different places, depending on where the user is coming from and what she wants to do next. Instead of relying on the user to directly start each application, the components themselves invoke one another to perform interactions on behalf of the user. Activities, Intents, and Tasks

Android classes

Activities, Intents, and Tasks An Android activity is both a unit of user interaction filling the screen of an Android mobile device—and a unit of execution. An Android program starts by subclassing the Activity class. Activities provide the reusable, interchangeable parts of the flow of UI components across Android applications.

How, does one activity invoke another, and pass information about what the user wants to do? The unit of communication is the Intent class. An Intent represents a function that one activity requires another activity to perform Activities, Intents, and Tasks

Intents form the basis of a system of loose coupling that allows activities to launch one another. When an application dispatches an intent, it’s possible that several different activities might be registered to provide the desired operation. Activities, Intents, and Tasks

Android programs look like we page applications A well-designed activity is resposible for managing a single UI page and each has its own unique name. Android applications find their interactions invoked by an intent. Activities provide UIs and the services.

When the system starts this activity it calls the constructor for TestActivity, a subclass of Activity, and then calls its onCreate method. This causes the view hierarchy described in the main.xml file to load and display. The onCreate method starts the life cycle of the Activity,

one of the most important classes in the Android system, promoting apps' modularity and allowing functionality to be shared. interacts with the Android runtime to implement key aspects of the application life cycle. Each activity is separate from other activities. one activity does not directly call methods in the code that implements another activity. The Activity class

Other elements in the Android framework—such the Intent —are used to manage communication instead. Instead of a user interface flow control based on method calls, applications describe an Intent that they want to execute and ask the system to find one that matches. The Activity class

Other Android Components: services, content providers, and broadcast receivers The Service class supports background functions. The ContentProvider class provides access to a data store for multiple applications, The Broadcast Receiver allows multiple parties to listen for intents broadcast by applications.

Content providers and intents are secondary APIs to use in order to take advantage of Android's strongest features and integrate seamlessly with the Android platform.

Service Class Background tasks that may be active but not visible on the screen. A music-playing application (service) continue to play music while a user might be viewing web pages. allow applications to share functions through long- term connections

Content Provider class A special Uniform Resource Identifier (URI) starting with the content://, which is recognized across the local device, gives you access to the content provider data To use a ContentProvider, you specify a URI and how to act on referenced data create (insert), read (query), update, and delete are basic data handling activities

Content Provider class by providing a ContentProvider, application can share data with other applications and manage the data model of an application. ContentResolver class, enables other components in an Android system to find content providers. Unique among the Inter Process Communication (IPC) systems found on other platforms, such as CORBA, RMI, and DCOM, which focus on remote procedure calls. shares entire SQL databases across processes

Provides the central content provider API, which you can subtype to manipulate specific types of data. Activities access specific content provider instances using the ContentResolver class and associated URLs as follows: Content Provider class

When a developer calls the query method on a content provider, the call returns a Cursor object that implements the android.database.Cursor interface. Content Provider class

BroadcastReceiver implements another variant of Android’s high-level interprocess communication (IPC) mechanism using Intent objects. receives the action of Intent objects, similarly to an Activity, but does not have its own user interface. might receive an alarm that causes an app to become active at a particular time

Component Life Cycles onCreate method starts an application. efficient use of each application’s memory, or heap space, enable the state of entire processes to be preserved and restored so that the Android system can run more applications than can fit in memory.

Activity Life Cycle most complex component life cycle The key elements of handling life cycle state transitions are: selecting which life cycle callbacks you need to implement, and knowing when they are called.

Activity Life Cycle Activity life cycle states

The runtime calls onSaveInstanceState method when it determines that it might have to destroy the activity, but wants to be able to restore it later.

The onRestoreInstanceState method is called when an activity that was destroyed is being recreated.

Static Application Resources and Context The app name, the intents it registers, the permissions it needs and so on are stored in a file called the manifest. These data are called resources. Together, all this information forms the context of the application, and Android provides access to it through the Context class.

Application Manifests Android requires applications to explicitly describe their contents in an XML file called AndroidManifest.xml includes content providers, services, required permissions, and other elements The file organizes an Android application into a well-defined structure that is shared by all applications and enables the Android operating system to load and execute them in a managed environment.

AndroidManifest.xml we declare an intent filter that tells Android when this Activity should be run.

Android applications place images, icons, and user interface layout files into a directory named res.

Applications access resources in these directories using the method Context.getResources() and the R class. directory gen, which contains a class always named R, which resides in the Java application package named in the Android manifest.

The Android Application Runtime Environment Android executes multiple instances of the Dalvik VM, one for each task. Android must divide memory into multiple small heaps. garbage-collected when heap space is tight, and then restored when needed.

Android’s approach to multiprocessing requires that each instance of the VM be space-efficient. This is achieved partly through the component life cycle, which enables objects to be garbage-collected and recreated, and partly by the VM itself. Android uses the Dalvik VM to run a bytecode system developed specifically for Android, called dex. The Android Application Runtime Environment

Zygote: Forking a New Process inefficient for each new process to load all the necessary base classes each time. Android puts each application in a separate process, it can take advantage of the fork operation in the underlying Linux OS to spawn new processes from a template process that is in the optimal state for launching a new VM instance. This template process is called Zygote. It is an instance of the Dalvik VM.

Sandboxing: Processes and Users Android makes an interesting use Linux’s inherent multi-user support: Android creates a new user for each application vendor. This means each application runs with different user privileges (except for those signed by the same vendor). Files owned by one application are, by default, inaccessible by other applications