Intents in Android 101 : all you need to know

Shubham Nikam
2 min readSep 3, 2018

--

What is an Intent in android?

It is a kind of messaging object which can use to request an action or information that is passed to the components. It is used to launch an activity, display a web page, send SMS, send email, etc.

There are three basic use cases of intents :

  • Starting an activity
  • Starting an Service
  • Broadcast Messaging

Types of intents

There are two types of intents : Explicit intent and Implicit intent.

Explicit Intent

It specify which application will satisfy the intent, by supplying either the target app’s package name or a fully-qualified component class name. You’ll typically use an explicit intent to start a component in your own app, because you know the class name of the activity or service you want to start.

Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);

Implicit Intent

It do not name a specific component, but instead declare a general action to perform, which allows a component from another app to handle it. for eg. open link in any available browser .

Below I have share all most used intents and fill free to customize as per your need…

Open link in browser

Open Email

Share Intent

Open Google Play

Open Map with specific location

Camera Intent

Phone Call Intent

SMS Intent

For more information visit Android Documentation.

Sign up to discover human stories that deepen your understanding of the world.

--

--

No responses yet

Write a response