Lecture 11: Intents Flashcards
What is an intent?
Android API object used to handle requests between different app components
What are the three major components intents are typically used with?
- Begin executing a activity class
- Begin executing a service
- To deliver a broadcast message all apps on the device
What is a explicit intent?
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
What is an implicit intent?
Defines an action then relies on the system to find an appropriate app to fulfill that action
What is the downside with explicit intents?
We dont know what apps a user has installed making it hard to reference them
In order to determine what apps may be used to fulfill an implicit intent we need some ___
generic ways of describing what apps do
What are the 2 categories that help inform the android system filter through apps
- actions
- categories
actions and categories form part of an ___ and reside in the __ of an app
- intent filter
- manifest folder
What are actions?
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
What are categories
Specify what apps we’re looking for
What make up the intent filter?
- category
- action
- datatype
What is the purpose of the intent filter?
Used to tell the system what our activities do and what kind of data they expect to interact with when called
What happens if no app can be found with a matching intent?
The startActivity() method will throw an exception so it needs to be wrapped in a try/except or null catch
What happens if multiple applications meet the intent criteria?
The user needs to make a choice about what app to use
What is the equivalent of the file picker interface for intents?
chooser