Search code examples
androidandroid-intentbroadcastreceiverintentfilter

intent-filter for knowing when some app is being opened?


I would like to know which intent-filter use for listen when some app is being opened from my BroadcastReceiver.

<intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
    <action android:name="android.intent.action.PACKAGE_REMOVED" />
</intent-filter>

Solution

  • Android OS doesn't allow this behavior. No broadcast will be sent out when a particular app is opened.

    However, you can have a service that is constantly running in the background and in that service you can use the ActivityManager to get a list of the current open apps. Based on that info, you can start your activity. This is a work around.