Sobes.tech
Junior — Middle

Can one Intent initiate the launch of another application on the device?

sobes.tech AI

Answer from AI

Yes, one Intent can initiate the launch of another application on the device. This is done using an explicit or implicit Intent that points to a component of another application (for example, an Activity). If the Intent is correctly formed and the target application is installed, the Android system will launch the corresponding component.

Example of launching an Activity from another application using an implicit Intent:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://www.example.com"));
if (intent.resolveActivity(getPackageManager()) != null) {
    startActivity(intent);
}

In this example, a browser or another application capable of handling the URL will open. To launch a specific Activity of another application, you can use an explicit Intent with the package and class specified.