How to implement implicit and explicit Android Intents in Kotlin

Oscar de la Hera Gomez
Three flowers that represent Kotlin, Android and Android Studio side by side. Beneath them sits the text “Implicit and Explicit Intents.”

A guide on what implicit and explicit intents are and how to implement them in Android apps using Kotlin.

A screenshot of the intents slide during Google I/O's What's new in Android privacy and security session.

Approximately 17.53 minutes into What's new in Android privacy and security

Implicit and explicit intents were discussed during Google I/O 2023's What's new in Android privacy and security session, and have been updated such that implicit intents only available to exported components.

What are implicit intents and how do I use them ?

An implicit intent specifies an action that can invoke any app on the device able to perform the action. Using an implicit intent is useful when your app cannot perform the action, but other apps probably can and you'd like the user to pick which app to use.

Sample code on how to use implicit intents can be found below.

What are explicit intents and how do I use them ?

An explicit intent is one that you use to launch a specific app component, such as a particular activity or service in your app. To create an explicit intent, define the component name for the Intent object—all other intent properties are optional.

Specific new additions that should be considered for explicit intents are:

  • setPackage - targets an exact application and offers you all components that can handle your intent.
  • setClassName - Targets an exact package name and exact component you want to run. e.g. if you want to use the Gmail app to send an email using this to run the exact Activity(Component) you want to run.

Sample code on how to use explicit intents can be found below.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details