farid99
farid99

Reputation: 712

How are android intents handled at runtime?

I understand that intents are used to start new activities and services and can contain information about these - certain UI options, etc. They can be emitted by some activities or apps to signal that others should begin or end, or that some change should occur.

I don't understand how these are handled by the System at runtime. Do these go to the OS, where they are relayed to the place where they are needed, or do all Activity instances constantly check every single intent that is emitted, to see if they apply?

Also, on that note, can all Activity instances "listen" to all intents and if not, how is this "listening privilege" given?

Upvotes: 1

Views: 61

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

Do these go to the OS, where they are relayed to the place where they are needed

Yes. After all, the majority of the time, the activity that is to be started does not presently exist.

Also, on that note, can all Activity instances "listen" to all intents

Activities do not "listen" on any Intents. Activities, via the manifest, describe what Intent structures they are interested in, via <intent-filter> elements. The OS then determines the activity to handle any particular startActivity() call (perhaps with the help of the user, via a chooser UI) and starts that activity.

Upvotes: 1

Related Questions