Android: select the application with which you can open the link

In Android applications, the choice of choosing an application to open a link or perform some other actions for the user, i.e. The environment allows the user to select an application to do something.

For example, let's say you have a link to a tweet, and you are allowed to choose between:

  • Twitter
  • Chrome
  • Web browser

What is the reason that the user is allowed to choose the application with which you can open the link, and not using your own application?

+1
android android-intent android-implicit-intent
Feb 16 '15 at 11:43
source share
3 answers

According to this :

Implicit intent indicates an action that any application can invoke on a device capable of performing the action. Using implicit intent is useful when your application cannot perform an action, but other applications may also want you to choose which application to use.

and this :

The real power of intent lies in the concept of implicit intentions. the implicit intention simply describes the type of action to perform (and, optionally, the data you would like to perform the action on) and allows the system to find a component on the device that can perform the action and run it. If there are several components that can perform the action described by the intention, then the user selects which one to use.

The idea is that in Android, a developer can let his application use another application on the device to perform a task, rather than re-create the same functionality in his own application. Often there is more than one application that can perform the same task, and therefore Android allows the user to choose which application they want to use for this task.

Basically, the structure tries to provide the most general way to accomplish a task: if there is no official Twitter application, then you always have Chrome .

How this is done in the code is displayed here .

+3
Feb 16 '15 at 11:57
source share

Basically, you get a list of applications that handle the Intent that you submit from your application.

For example, if you create this intention

 Uri number = Uri.parse("tel:5551234"); Intent callIntent = new Intent(Intent.ACTION_DIAL, number); 

Any application that can handle Intent.ACTION_DIAL will appear in your selection list. In your case, when you process links, Twitter, Chrome and Web Broswer are all applications that can handle these intentions, so they appear in the selection list.

You can read about it here .

+1
Feb 16 '15 at 11:45
source share

Google presented implicit intentions, but these intentions are ambiguous, and Google decided to let the person resolve this ambiguity.

In some cases, the robot simply cannot make the right choice. For example, how can a robot decide which application should open a link from the list: Opera, Chrome, web browser?

It might seem that applications such as twitter and google translate are better suited for certain links, but in practice the applications are buggy (applications are automatically updated, so errors can be painted over, and server updates mean that application updates, errors can appear even on devices with automatic updates disabled), and sometimes the user may want to open a link with a browser, and not with a dedicated application.

+1
Feb 16 '15 at 12:42
source share



All Articles