Andrew T.
Andrew T.

Reputation: 4686

How to get all intent filters for application (with root)

I am working on a system application and I need to know programmatically what intents an application is capable of handling. I have seen other questions related to this, but none of them seem to have an answer but also do not seem to be concerned with system privileges.

PackageManager only seems to provide methods to query activities for a given intent. I can not find a way to get intents for a given activity.

For example, if I have an activity which has intent filters defined as such:

<intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED"/>
    <action android:name="android.intent.action.USER_PRESENT"/>
</intent-filter>

And I know the activities class name and package name, I would like to find out from the package manager (or any other source) what intents it can handle (in this case, BOOT_COMPLETED and USER_PRESENT).

Upvotes: 5

Views: 4126

Answers (3)

hartwig
hartwig

Reputation: 1

you could try a decompiler, such as "DexDump" (available on GooglePlay), and retrieve the "AndroidManifest.xml" of the application you want to know about.

Upvotes: 0

Andrew T.
Andrew T.

Reputation: 4686

So after just asking this question, I found this wonderful answer here:

Android — How to I get a list of all available intent filters?

Which leads to this 5 year old issue

So it doesn't seem like there is any way to do what I want to do at the moment. If it becomes available, I would love to know.

Upvotes: 2

VJ V&#233;lan Solutions
VJ V&#233;lan Solutions

Reputation: 6554

Good question. I don't think it's possible to find out the intents that an app can handle. Some standard activity actions and broadcast actions are listed at http://developer.android.com/reference/android/content/Intent.html. If you are writing your own app that's having it's own intent filters, then i don't think other apps will know what intents your app can handle because there is no way to publish them or announce them to the world, i believe.

But what is possible is that you can make a call for a particular intent and if that returns null, then you know for sure that there are no apps on the device that can handle that particular intent.

HTH.

Upvotes: 4

Related Questions