Top Banner
Overview of Android: Key App Components Douglas C. Schmidt [email protected] www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA
18

Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

Sep 28, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

Overview of Android: Key App Components

Douglas C. Schmidt

[email protected]

www.dre.vanderbilt.edu/~schmidt

Professor of Computer Science

Institute for Software

Integrated Systems

Vanderbilt University

Nashville, Tennessee, USA

Page 2: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

2

Learning Objectives in this Part of the Lesson1. Understand key elements

in Android’s middleware infrastructure

2. Name all the key app components in Android

Page 3: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

3

Overview of Key Android App Components

Page 4: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

4

Overview of Key Android App Components• App components are essential building

blocks of mobile apps that provide various hooks via which Android can effect an app’s lifecycle

See developer.android.com/guide/components/fundamentals.html#Components

Content

Provider

ServiceActivity

Broadcast

Receiver

Page 5: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

5

• Intent

• A message that describes an action toperform or an event that has occurred

See developer.android.com/reference/android/content/Intent.html

Overview of Key Android App Components

Page 6: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

6

• Intent

• A message that describes an action toperform or an event that has occurred

• Android uses intents as “glue” to simplify the integration of apps that reuse existing components

Service

Intent

<...

android:name="..."

<intent-filter>

<action android:name="..." />

</intent-filter>

</...>

BroadcastReceiver

Activity

Overview of Key Android App Components✓ Name, Action

✓ Data, Category

✓ Extras, Flags

Page 7: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

7

• Activity

• Provides a screen within which users can interact to do a single focused thing

Overview of Key Android App Components

See developer.android.com/reference/android/app/Activity.html

Page 8: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

8

• Activity

• Provides a screen within which users can interact to do a single focused thing

• It’s the most common type of Android component

Overview of Key Android App Components

See developer.android.com/guide/components/activities.html

Page 9: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

9

• Activity

• Provides a screen within which users can interact to do a single focused thing

• It’s the most common type of Android component

Overview of Key Android App Components

Activities are at the heart of all Android apps

Page 10: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

10

• Broadcast Receiver

• Event handler that can respond to system-wide broadcasts

See developer.android.com/reference/android/content/BroadcastReceiver.html

Overview of Key Android App Components

Page 11: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

11

• Broadcast Receiver

• Event handler that can respond to system-wide broadcasts

• Activities & services in 1+ apps can interact by broadcasting intents handled by 0+ broadcast receivers

Overview of Key Android App Components

PhoneApp

System Server

Broadcast Receivers

Battery Service

Activity Manager Service

Page 12: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

12See developer.android.com/reference/android/app/Service.html

• Service

• Runs in background to perform long-running operations or access remote resources

Overview of Key Android App Components

Page 13: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

13

• Service

• Runs in background to perform long-running operations or access remote resources

• A bound service has a lifecycle that depends on its creating component(s)

Overview of Key Android App Components

See developer.android.com/guide/components/services.html

Page 14: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

14

• Service

• Runs in background to perform long-running operations or access remote resources

• A bound service has a lifecycle that depends on its creating component(s)

• A started service’s lifecycle doesn’t depend on its creating component

Overview of Key Android App Components

Started services are deprecated in later versions of Android

Page 15: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

15

• Content Provider

• Manages access to structured data & provides data security mechanisms

See developer.android.com/reference/android/content/ContentProvider.html

Overview of Key Android App Components

Page 16: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

16

• Content Provider

• Manages access to structured data & provides data security mechanisms

• Content Providers/Resolvers can make an app’s data available to other apps

See developer.android.com/guide/topics/providers/content-providers.html

Overview of Key Android App Components

Page 17: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

17

Overview of Key Android App Components• We cover intents, activities, & broadcast

receivers in MOOC 2 & services & content providers in MOOC 3 of the Android App Development specialization

Content

Provider

ServiceActivity

Broadcast

Receiver

See www.coursera.org/specializations/android-app-development

Page 18: Overview of Android: Key App Componentsschmidt/cs891s/2020-PDFs/11.3.4-overvie… · 2 Learning Objectives in this Part of the Lesson 1. Understand key elements in Android’s middleware

18

End of Overview of Android: Key App Components