Is a way of communicating between different components of an app or between different apps. It can be used to start an activity, a service, or a broadcast receiver, or to send data to another app. There are two types of intents: implicit and explicit.

<aside> 💡 In android developer can use intent to exchange data between activities, services and broadcast receivers.

</aside>

How to exchange data between two component via intents?

To exchange data between two components via intent, you can use the putExtra() method to attach extra data to the intent, and the getExtra() method to retrieve the data from the intent. The data can be of primitive types, such as int, boolean, or String, or of Parcelable or Serializable types, such as custom objects. Here are some examples of how to exchange data between two activities using intents:

Intent intent = new Intent(this, SecondActivity.class);
intent.putExtra("name", "John");
startActivity(intent);
Intent intent = getIntent();
String name = intent.getStringExtra("name");

Intent Sniffing

In this attack the hacker create app which listen for interesting intents. For example listen for SMSs, Emails, URLs and etc. which contains important data.

Example:

Intent Filter

An intent filter is a way of telling Android what your app can do. For example, if your app can open a web page, you can use an intent filter to tell Android that your app can handle web links. Then, when the user clicks on a web link, Android will show your app as an option to open it. An intent filter has three parts: action, category, and data