android - 如何列出符合 Intent 的 Activity ?

标签 android android-intent intentfilter

我有几个单独的应用程序,它们都是完全通过主应用程序启动的。

我想知道我是否能够使用 Intent 来检索与某些发现 Intent 匹配的所有子应用程序的列表。

主应用程序目前需要知道使用什么 Intent 来启动这些子应用程序,但是有没有一种方法可以使用 Intent 来查看设备上的其他 Activity 是否与一组 Intent-filters 匹配?

最佳答案

I am wondering if I'd be able to use intents to retrieve a list of all the sub-applications which match some discovery intent.

当然。使用 PackageManager,可能还有 queryIntentActivities() 方法来实现您的目标。

This old sample Java code演示了通过 queryIntentActivities() 查找所有启动器 Activity 。

关于android - 如何列出符合 Intent 的 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2659898/

相关文章:

android - android-getpath方法返回错误的地址

Android 自定义 URI 方案无法在某些版本的 Android 上启动应用程序,但适用于其他版本

android - android list 文件中main,default和launcher的用途是什么

android - 在推广封闭测试轨道时,Google Play 会自动发布到生产环境吗?

java - 滚动 Android 中 Activity 中的所有元素

android - Ionic 3 版本未更新——Android/Mac

android - 拦截 HTC sense 上的 ACTION_CALL Intent

Android:MotionLayout 不允许 child 展开并填满屏幕

所有应用程序上 onResume() 的 Android 监听器

Android:停止 Intent 并返回到主要 Activity