- Messaging Object
- Can be used to request an action from another component.
- Facilitate communication between components in several ways.
- Start an activity.
- Start a service.
- Deliver a broadcast.
- Explicit intents: Specify the name by component class name. Can be used only to start a component in your own app.
- Implicit intents: Specify the general action to be performed, which allows component from other app to handle it.
Note: Beginning with Android 5.0 (API level 21), the system throws an exception if you call bindService() with an implicit intent.
Building an Intent
- Intent object carries information that the Android system uses to determine which component to start.
- Component Name: Name of the component, Optional for implicit intent but critical for explicit intent.
- Action Name : Specifies the generic action to perform.
- Data: The URI (a Uri object) that references the data to be acted on and/or the MIME type of that data
- Category: Additional information about the kind of component that should handle the intent
- Extras: Key-value pairs that carry additional information required to accomplish the requested action.
- Flag: flags instruct the Android system how to launch an activity.
- Declare intent filters for each of your app components with an <intent-filter> element in your manifest file.
- Each intent filter specifies the intent's action, data, and category.
- The system will deliver an implicit intent to your app component only if the intent can pass through one of your intent filters.
Using a Pending Intent
- PendingIntent object is a wrapper around an Intent object.
- Grants permission to other application use the contained Intent as it is executed from your own app process.
Intent Resolution
- TBU
No comments:
Post a Comment