Android OS : Core Concepts
description
Transcript of Android OS : Core Concepts
![Page 1: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/1.jpg)
Android OS : Core Concepts
Dr. Jeyakesavan VeerasamySr. Lecturer
University of Texas at [email protected]
![Page 2: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/2.jpg)
Agenda
• Introduction to Android devices• Environment overview• Android concepts• Application components– Activities, Services, Content providers, Broadcast
receivers• “Hello” application• Summary
![Page 3: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/3.jpg)
Development Environment
• Java Development Kit (JDK) • Eclipse IDE• Android Development Tools (ADT) plug-in• SDK starter package– Platforms (1.0, 2.0, 3.0, 4.1, …)– Tools (debug, …)
Reference: http://developer.android.com/sdk/installing.html
JDK
Eclipse ADTPlug-in
AndroidSDK
![Page 4: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/4.jpg)
Development Process for
Android Applications
![Page 5: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/5.jpg)
Android Architecture
![Page 6: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/6.jpg)
Android Runtime Environment
• Dalvik VM for each application• common Linux kernel
JRE
x.class y.class
Linux kernel
VM VMAPP APP
…
![Page 7: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/7.jpg)
Basics: UNIX security
• compare it with Windows security
![Page 8: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/8.jpg)
Application Security
• Android operating system is based on multi-user Linux system.
• Each application is treated as a different user. Each application uses unique Linux user ID.
• Every application runs as a Linux process.
![Page 9: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/9.jpg)
Application security …
• It's possible to arrange for two applications to share the same Linux user ID, in which case they are able to access each other's files – can run as same Linux process and share the same VM (applications use same certificate).
• An application can request permission to access device data such as the user's contacts, SMS messages, the mountable storage (SD card), camera, Bluetooth, and more. All application permissions must be granted by the user at install time.
![Page 10: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/10.jpg)
Processes & Threads
• Every application runs in its own process and all components of the application run in that process, by default -- UI thread
• Any slow, blocking operations in an activity should be done in a new thread, to avoid slowing down the user interface.– If application does not respond in 5 seconds, "
application not responding" (ANR) dialog appears.
![Page 11: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/11.jpg)
Process lifecycle: Importance Hierarchy
• Foreground process• Visible process• Service process• Background process• Empty process
“Lower importance” tasks may be killed by Android – why?How to select a lucky one from a pool?
![Page 12: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/12.jpg)
IPC
• Remote procedure calls (RPCs)
![Page 13: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/13.jpg)
Android Application components
• Activities - front-end UI screens• Services – back-end support• Content providers – application data – SQLite, web or SD card
• Broadcast receivers – handle system events
![Page 14: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/14.jpg)
Activitating Components: Intent
![Page 15: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/15.jpg)
Basics: Data Exchange
A1
A3
A2
A4
![Page 16: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/16.jpg)
Basics: Data Exchange
• Binary or text data XML or JSON …
• Independent data checkers tools available.A1
A3
A2
A4
![Page 17: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/17.jpg)
Sample XML data file
Text format:Belgian Waffles, 5.95, two of our famous Belgian Waffles with plenty of real … , 650Strawberry Belgian Waffles, 7.95, light Belgian waffles covered with …., 900
![Page 18: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/18.jpg)
Application info: Manifest file
• Declare components• Declare application requirements• Application Resources?
![Page 19: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/19.jpg)
Activity lifecycle: 3 states
• Resumed or Running• Paused• Stopped
![Page 20: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/20.jpg)
State machine
![Page 21: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/21.jpg)
Code
![Page 22: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/22.jpg)
Service Lifecycle
![Page 23: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/23.jpg)
User Interface Design
![Page 24: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/24.jpg)
XML Layouts
• Declare UI elements in XML. Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses.
• Instantiate layout elements at runtime. Your application can create View and ViewGroup objects (and manipulate their properties) programmatically.
![Page 25: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/25.jpg)
Application Resources
![Page 26: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/26.jpg)
Building & running Android app
![Page 27: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/27.jpg)
Program to say “Hello!”
![Page 28: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/28.jpg)
Native Development Kit (NDK)
• Use C/C++ for development• primarily for performance critical components
![Page 29: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/29.jpg)
Summary• Clean, sophsticated, yet reasonably simple.• Android requires strong Java skills – heavy use of
derived classes (inheritance).• Development: Java code & XML definitions• Reference: http://
developer.android.com/sdk/installing.html• Install Android development environment and
play with a few examples or try your own ideas!• Marketable skill in the industry!
![Page 30: Android OS : Core Concepts](https://reader036.fdocuments.net/reader036/viewer/2022062315/56816326550346895dd3a04c/html5/thumbnails/30.jpg)
More references• http://www.vogella.de/articles/AndroidIntent/article.html• http://developer.android.com/resources/browser.html?tag=sa
mple