我有一个service在运行,当用户点击了一个应用程序,在它得到运行之前,如何获取到将要启动的这个应用程序的信息呢?
或者说如何监听到用startactivity启动的activity所属的APK的信息呢?

解决方案 »

  1.   

    当启动一个程序的时候,会启动该程序的主Activity,系统会发送action为
    android.intent.action.MAIN 和
    android.intent.category.LAUNCHER的广播,注册一个广播接收器,接收广播。
      

  2.   

    intent.category.LAUNCHER是广播?我试试..
      

  3.   

    我注册了一个这样的广播,接收不到启动程序的广播。。
    <receiver android:name=".TestReceiver">
    <intent-filter>
    <action android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </receiver>
      

  4.   

    android.intent.category.LAUNCHER 不是一个广播吧。。
      

  5.   

    CATEGORY_LAUNCHER 不行还有什么办法吗?
      

  6.   

    启动一个程序的intent为:
    android.intent.action.MAIN
    android.intent.category.LAUNCHER
    都不是系统广播的intent,那么这种intent怎么捕捉呢?