This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit

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 Application Model (3)
Android 02: Activities David Meredith
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
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.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
1 CSCE 4013: Mobile Systems Programming Nilanjan Banerjee Mobile Systems Programming University of Arkansas Fayetteville, AR
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit
@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.
Android: versions Note that: Honeycomb (Android v3.0) A tablet-only release Jelly Bean (Android v4.1) Released on July 09, 2012.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
CS5103 Software Engineering Lecture 08 Android Development II.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Content Providers & Services.
© 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.
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Data Storage: Part 4 (Content Providers). Content Providers Content providers allow the sharing of data between applications. Inter-process communication.
COMP 365 Android Development.  Manages access from a central database  Allows multiple applications to access the same data.
Rajab Davudov. Agenda Eclipse, ADT and Android SDK APK file Fundamentals – Activity – Service – Content Provider – Broadcast Receiver – Intent Hello World.
COMP 365 Android Development.  Perform operations in the background  Services do not have a user interface (UI)  Can run without appearing on screen.
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.
10/10/2015 E.R.Edwards 10/10/2015 Staffordshire University School of Computing Introduction to Android Overview of Android System Android Components Component.
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.
Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml.
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.
Services A Service is an application component that can perform long-running operations in the background and does not provide a user interface. An application.
DKU-MUST Mobile ICT Education Center 10. Activity and Intent.
Lecture 2: Android Concepts
1 Android Workshop Platform Overview. 2 What is Android?  Android is a software stack for mobile devices that includes an operating system, middleware.
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.
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
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.
Android Mobile Application Development
Lecture 2: Android Concepts
Android 01: Fundamentals
Android Application Development 1 6 May 2018
CS371m - Mobile Computing Services and Broadcast Receivers
Lecture 2 Zablon Ochomo Android Programming Lecture 2 Zablon Ochomo
Instructor: Mazhar Hussain
MAD.
Activities and Intents
Android Mobile Application Development
The Android Activity Lifecycle
Android Programming Lecture 9
Application Fundamentals
Application Development A Tutorial Driven Course
Activities and Intents
HNDIT2417 Mobile Application Development
Activities and Intents
Emerging Platform#3 Android & Programming an App
Mobile Programming Dr. Mohsin Ali Memon.
Introduction to Android
Application Fundamentals
Lecture 2: Android Concepts
Presentation transcript:

This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. Lecture 2 – Android SDK

Laura Gheorghe, Petre Eftime Android Manifest  xml file  In the root of the app directory  Describes application components and resources  Application name and Java package (unique)  Activities, Services, Broadcast Receivers, Content Providers  Start activity  Permissions  Libraries  Minimum API level 2

Laura Gheorghe, Petre Eftime Permissions 3  Determine what resources and APIs an application can access  Meant to provide security through sandboxing  Declared in the Manifest   Permission is asked at install time: all or nothing  Can not be granted afterwards  Control who can access your components and resources  Start activity, start or bind service, send broadcasts, access data in Content Provider  URI permissions

Laura Gheorghe, Petre Eftime Resources 4  res/ directory  Each resource type in a different subdirectory with specific name  drawable/, layout/, values/, menu/, xml/, etc.  The default resources  For different configurations we may need different resources  Bigger screen -> different layout  Different language -> different strings  Subdirectory for each alternative set of resources  -  drawable-hdpi/ for High Density Screens  Resource chosen at runtime based on the configuration  An ID is generated for each resource name in gen/

Laura Gheorghe, Petre Eftime Layouts 5  Resources from res/layouts/  Describe the UI of an activity or part of the UI  res/layout/filename.xml  Filename is used as resource ID  UI elements  Can be edited as an xml or using the tools provided  Easy to learn, hard to master

Laura Gheorghe, Petre Eftime Drawables 6  Resources from res/drawables/  Element that can be drawn on the screen  Can be images (.png,.jpg, or.gif) or xmls  xmls describe how an UI element reacts to input (pressed, focused)  xmls point to images  Visual feedback for interaction

Laura Gheorghe, Petre Eftime Activity 7  Application component  User interface window, provide user interaction  Require a layout  Can only draw and change UI from the Looper thread  Computationally intensive or wait based tasks on separate threads  An application may include multiple activities  Only one is the main activity  Activities can start each other -> the previous one is stopped  Activity stack ("back stack")  Back -> activity destroyed and previous one resumed

Laura Gheorghe, Petre Eftime Activity Lifecycle 8 Source:

Laura Gheorghe, Petre Eftime Activity Lifecycle 9  Activities can be killed after onPause(), onStop() in low memory situations  The activity state (objects) are lost  Can preserve state by saving objects  User interaction can be saved and restored  Callback onSaveInstanceState()  Save information in a Bundle  onCreate(), onRestoreInstanceState()  Restore the activity state  Threads can be stopped graciously  In onPause() threads should be signaled to stop

Laura Gheorghe, Petre Eftime Save Activity State 10 Source:

Laura Gheorghe, Petre Eftime UI 11  UI is a hierarchy of views  View: rectangular space, provides user interaction  Buttons, Lists, Fragments, Images, Text Boxes  Callbacks for actions  A ViewGroup includes other View or ViewGroup objects  Classes can be extended to provide more complex views  Adapters allow for more complex data types to be displayed

Laura Gheorghe, Petre Eftime Service 12  Performs operations in the background  Does not provide a UI  Continues to run even if another application is in foreground  Is able to perform network transactions, le I/O operations, interact with content providers, etc.  Runs in the main thread of the hosting process  A separate thread should be created if the service performs CPU intensive or blocking operations

Laura Gheorghe, Petre Eftime Service 13  Can be started by any application using an Intent  Block access from other apps by declaring the service as private in the manifest  It may run as an independent application, with no UI, that provides functionality to other applications  Is started when another application binds to it  Or using am start service

Laura Gheorghe, Petre Eftime Types of Services 14  Started  An application component calls startService()  Performs a single operation, then stops itself and does not return a result to the caller  Runs even if the caller component is destroyed  Bound  An application component binds to it by calling bindService()  Provides a client-server interface - send requests, return results  Runs as long as the application component is bound to it  Multiple components can bind to a service at once  Service destroyed after all components unbind

Laura Gheorghe, Petre Eftime Service Lifecycle 15 Source:

Laura Gheorghe, Petre Eftime Intent 16  An object used for delivering a message  Used for  Starting an activity  Starting or binding a service  Delivering a broadcast message  Includes component name, action and data  Intent filters  Declare the types of intents that a component can receive  Specified in the manifest - ,

Laura Gheorghe, Petre Eftime Types of Intents 17  Explicit intents  Specify exactly which component to start (the class name)  Typically used to start components in your own app  Will be delivered even if there is no intent filter declared  Implicit intents  Do not specify the exact component  Declare a general action to be performed  The Android system finds the appropriate component  Compares the intent to the intent filters in the manifest of the apps

Laura Gheorghe, Petre Eftime Implicit Intents 18 Source:

Laura Gheorghe, Petre Eftime Broadcast Receiver 19  Responds to system-wide broadcast announcements  The system generates many broadcasts  Example: battery is low, screen has turned o, etc.  Apps can generate broadcasts - send an announcement for other apps  No UI, may create a notification in the status bar to alert the user  The receiver lets other components perform the work based on the event

Laura Gheorghe, Petre Eftime Broadcast Receiver 20  Each broadcast is delivered as an Intent  Intent passed to startBroadcast() or startOrderedBroadcast()  Local broadcasts using LocalBroadcastManager  More efficient  Data does not leave the app  Other apps cannot send the broadcast - no security holes  Register a receiver in two ways  Statically in the manifest using the tag  Dynamically using Context.registerReceiver()

Laura Gheorghe, Petre Eftime Types of Broadcasts 21  Normal broadcasts  Completely Asynchronous  All receivers run in an undefined order  Ordered broadcasts  Delivered to one receiver at a time  Each receiver executes and may propagate the result to the next or abort the broadcast  The order is determined using the android:priority in the of the receiver

Laura Gheorghe, Petre Eftime Content Provider 22  Provide access to a repository of data  To access a provider you have to request specific permissions (in the manifest)   Two ways of storing data  File data - audio, video, photos  Structured data - database, array, etc.  Form compatible with tables of rows and columns  Usually a SQLite database

Laura Gheorghe, Petre Eftime Content Provider 23  Interface for accessing data in one process from another process  Provider and provider client  The application that owns the data includes the provider  The client application owns the provider client  Access data using a ContentResolver client object  Its methods provide CRUD (create, retrieve, update, delete) functions  Calls the methods with the same name in the ContentProvider object

Laura Gheorghe, Petre Eftime Content URIs 24  Identify data in the provider  Include a symbolic name for the provider (authority) and a name for the table (path)  Example: content://user_dictionary/words  The ContentResolver uses the authority for identifying the provider  From a system table with all known providers  The ContentResolver sends a query to the provider  The ContentProvider uses the path to identify the table

Laura Gheorghe, Petre Eftime Bibliography 25  nifest-intro.html  erview.html  es.html  s.html  ntent-providers.html  -filters.html

Laura Gheorghe, Petre Eftime Keywords 26  Manifest file  Permissions  Resources  Layouts  Drawables  Activity  Service  Intent  Broadcast Receiver  Content Provider  Content URI