0

I know that public (named) intents that are registered with the system and can be called from any application and private (anonymous) intents that are used within a single application. please can anyone give me an example for better understanding.

Thanks in advance

satti
  • 11
  • 2

2 Answers2

0

The Android documentation does probably the best job of explaining it, here is a relevant snippet:

There are two primary forms of intents you will use.

Explicit Intents have specified a component (via setComponent(ComponentName) or setClass(Context, Class)), which provides the exact class to be run. Often these will not include any other information, simply being a way for an application to launch various internal activities it has as the user interacts with the application.

Implicit Intents have not specified a component; instead, they must include enough information for the system to determine which of the available components is best to run for that intent. When using implicit intents, given such an arbitrary intent we need to know what to do with it.

This is handled by the process of Intent resolution, which maps an Intent to an Activity, BroadcastReceiver, or Service (or sometimes two or more activities/receivers) that can handle it.

Explicit intents you use in your activity to start internal activities.

While implicit intents are used often used to launch other activities like when you want to share a link or email something, you send out an implicit intent and let the user decide the email client to use to send the email or to share the link.

There are some instances where you might want to use an implicit intent to run an internal component of your app, because it seems to be more stable.

Community
  • 1
  • 1
Emil Davtyan
  • 13,808
  • 5
  • 44
  • 66
0

Sorry no time to write a full answer, but you can create custom permissions in order to sign your Intents & BroadcastReceivers.

When you use these custom permissions, only apps that have been signed with the same signing key, and include that custom permission, can see these Intents.

This question might help you:


@Commonsware explains the issue really well in a recent blog post:

Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255