What is an Intent in Android?

Technology CommunityCategory: AndroidWhat is an Intent in Android?
VietMX Staff asked 3 years ago

An Intent is basically a message that is passed between components (such as Activities, Services, Broadcast Receivers, and Content Providers).So, it is almost equivalent to parameters passed to API calls. The fundamental differences between API calls and invoking components via intents are:

  • API calls are synchronous while intent-based invocations are asynchronous.
  • API calls are compile-time binding while intent-based calls are run-time binding.

To listen for an broadcast intent (like the phone ringing, or an SMS is received), you implement a broadcast receiver, which will be passed the intent. To declare that you can handle another’s app intent like “take picture”, you declare an intent filter in your app’s manifest file.

If you want to fire off an intent to do something, like pop up the dialer, you fire off an intent saying you will.

An Intent provides a facility for performing late runtime binding between the code in different applications.