PACKAGE_ADDED BroadcastReceiver doesn't work

Did you run the app that contains this broadcastReceiver before installing the other apps?

Starting at some API version, broadcastReceivers will not work till you execute the app. Put an activity and execute it.

Also , don't forget to add the following into the broadcastReceiver:

<data android:scheme="package" />

EDIT: On Android 8 and above, if your app targets API 27 or more, it will work partially, so you have to register to those events in code and not in manifest. Here's a list of intents that are still safe to use in manifest: https://developer.android.com/guide/components/broadcast-exceptions.html .

The rest should be used in code. More info here


Since android.intent.action.PACKAGE_ADDED is a System Intent (note that your own app will not receive it at its installation), your BroadcastReceiver will receive messages from sources outside your app. Thus, check you did NOT put: android:exported="false"

You also may need to add:

<data android:scheme="package" />

So, your BroadcastReceiver in your AndroidManifest.xml should look like this:

<application ...>
    <receiver android:name=".NewAppReceiver" android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_ADDED" />
            <data android:scheme="package" />
        </intent-filter>
    </receiver>
</appcication>

If it still doesn't work, you may try to put an higher priority, such as: android:priority="1000"

Take a look at: http://developer.android.com/guide/topics/manifest/receiver-element.html


Are you trying to receive the intent in the application you are installing? The documentation for ACTION_PACKAGE_ADDED says:

Note that the newly installed package does not receive this broadcast.

Another possibility is that this intent might not be delivered to components registered via the manifest but only manually (as described in an answer by Mark Murphy to Stack Overflow question Can't receive broadcasts for PACKAGE intents).