Technologies

INTENTS

Intent is an abstract description of the operation to be performed. This passive data structure is used to trigger actions and works as a connecting layer responsible for the interaction between code components within the application itself and with other programs.


For example, when you point the camera at a QR code from a restaurant menu and are redirected to a browser, the transition is possible thanks to this structure. Or when you send a photo from the gallery to the editor, and from there to the messenger, each of these programs uses Intents. If you can't choose where you want to send the file from the drop-down list in the application, it means that the developers of the program did not provide for the relationship and did not use an intent.

What is Intents and how it works

According to the official Android documentation, intents are objects of the messaging class that can be used to request an action from another component of the application. Intents are used to launch: activities, including child activities, and services - that is, any functions and other programs. They can be:

01
Explicit

Explicit, when the target component is defined by the application itself.

02
Implicit

Implicit, when the operating system evaluates the available components and selects the appropriate one.

For example, if you've been sent a link to a YouTube video, if you have an app of the same name, it will automatically open in it thanks to Explicit Intents. If there is no app or you have been sent, for example, a text document, Implicit Intents will open it in the right application for reading. In addition, you will have options to send the file to other programs you use, pre-filtered by the intent-filter tag, in the form of a list. At the same time, depending on the selected program, other actions will become available, such as selecting a contact in the messenger or the type of post on a social network. A separate Intent is created for each of these interactions.

3 reasons to use Intents in your project
01
01
Improve the user experience

Intens are equally important for external interactions, such as the ability to share anything on social networks, and for internal ones, to conveniently transfer content between applications on a smartphone or tablet. Accessing maps, installing extensions, and collaborating are just a small part of what is impossible without intens.

02
02
Expand the service

Intents are responsible for exchanging data with external services, including online payment systems. Without this tool, it is impossible to redirect the customer to the payment page, as well as related actions, such as going to the banking application to confirm the transaction.

03
03
Create an ecosystem

Intens have always been part of the Android code, and starting with iOS 6, they work in applications for this operating system. The extension of intensities became necessary to increase the convenience of working not only with a smartphone, but also with other devices, such as a simple Bluetooth headset to connect to it, and more complex devices. Google and Apple provide developers with detailed instructions on how to use Intens to customize the interaction of an app with smartwatches and smart speakers. In this case, Intens is used to organize work with Google Assistant and Siri voice control. Of course, this can work not only for the default branded applications, but also for any other applications whose developers want to integrate their software into the ecosystem.

Conclusion

Intents are a mandatory part of any application that is responsible for the ability to interact with other programs and services. In fact, even the simplest application, such as a calendar or a shopping list, now equally requires intents to enable the user to add a map to an event or share a grocery list with the family. It is Intents that enable online payment, voice control, collaboration, and thousands of other simple and highly complex functions.