Lecture 11: Intents Flashcards

1
Q

What is an intent?

A

Android API object used to handle requests between different app components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the three major components intents are typically used with?

A
  • Begin executing a activity class
  • Begin executing a service
  • To deliver a broadcast message all apps on the device
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a explicit intent?

A

Refers directly to the app package name or component name when declared and starts the named component

Typically used internally to call other activities within your own app

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an implicit intent?

A

Defines an action then relies on the system to find an appropriate app to fulfill that action

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the downside with explicit intents?

A

We dont know what apps a user has installed making it hard to reference them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In order to determine what apps may be used to fulfill an implicit intent we need some ___

A

generic ways of describing what apps do

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 2 categories that help inform the android system filter through apps

A
  • actions
  • categories
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

actions and categories form part of an ___ and reside in the __ of an app

A
  • intent filter
  • manifest folder
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are actions?

A

A set of pre-defined constants that help describe what an activity does and what parameters it can expect to receive as part of the intent call

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are categories

A

Specify what apps we’re looking for

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What make up the intent filter?

A
  • category
  • action
  • datatype
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the purpose of the intent filter?

A

Used to tell the system what our activities do and what kind of data they expect to interact with when called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What happens if no app can be found with a matching intent?

A

The startActivity() method will throw an exception so it needs to be wrapped in a try/except or null catch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What happens if multiple applications meet the intent criteria?

A

The user needs to make a choice about what app to use

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the equivalent of the file picker interface for intents?

A

chooser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A chooser can be built from an __ and will enumerate all apps with a matching ___ in their ___

A
  • intent
  • intent filter
  • manifest
17
Q

When using a chooser the user will be prompted to pick which ___ to use, at which point the __ targeted by the __ will be called

A
  • app
  • app
  • intent
18
Q

What will happen if you dont use a chooser

A

Android will still provide the user with a choice of which app to use if it finds more than one matching app

Uses a disambiguation dialog

19
Q

What is the difference between a chooser and a disambiguation dialog?

A

Chooser takes up the full screen and has a customizable title

20
Q

How can we request that an activity returns data back to our own app?

A

Use an ActivityResultLauncher to launch the specified activity then call a callback function with the data to pass

21
Q

What makes up the ActivityResultLauncher

A

Takes a contract type, and a callback function thats executed when the activity called is completed

22
Q

What class defines the type of intents and parameters used for an ActivityResultLauncher?

A

ActivityResultContract