Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What is an Intent, and what is the difference between explicit and implicit intents?

An Intent is a messaging object describing an operation to be performed. It is how Android components communicate, including across app boundaries.

  • An explicit Intent names the exact component to start, by class. Used for navigation within your own app — starting your own Activity or Service. It is unambiguous and secure, because you know exactly what will handle it.
  • An implicit Intent declares an action and lets the system find a component that can handle it. Sharing text, opening a URL, dialling a number, or picking an image. The system matches the action, data, and category against the intent filters declared by installed apps, and shows a chooser if several qualify.
// Explicit
startActivity(Intent(this, DetailActivity::class.java))

// Implicit
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))

Practical points that matter:

  • Always handle the case where nothing can handle an implicit Intent, or the app crashes with ActivityNotFoundException.
  • Package visibility since Android 11 means you must declare <queries> in the manifest to see which apps can handle certain intents.
  • Never send sensitive data in an implicit Intent — any app with a matching filter can receive it.
  • PendingIntents must specify mutability (FLAG_IMMUTABLE or FLAG_MUTABLE) from Android 12, and immutable should be the default.
All Android interview questions

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as