以编程方式列出意图过滤器

sga*_*man 5 android intentfilter android-activity

在 android Activity 中,有没有办法以编程方式列出它已注册的内容?

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
Run Code Online (Sandbox Code Playgroud)

我正在尝试确定当前活动是否为 LAUNCHER。

dld*_*dnh -1

我认为包管理器会告诉你你在寻找什么。

http://developer.android.com/reference/android/content/pm/PackageManager.html

public abstract ActivityInfo getActivityInfo (ComponentName component, int flags)
Run Code Online (Sandbox Code Playgroud)

其中标志可能包含

GET_INTENT_FILTERS
Run Code Online (Sandbox Code Playgroud)

  • 它对你有用吗?看来这个标志并不真正受支持https://code.google.com/p/android/issues/detail?id=3217 (2认同)