How to detect new apps in an Android device

I want to detect when the user installs or deletes an app, and I didn't find a BroadcastReceiver that does this.

In my app, I get the information about the installed apps with the class PackageManager, but I don't want to scan the apps periodically. Is there any BroadcastReceiver that does this? Or any ContentObserver? Is it possible to get a notification that an app has been installed or removed?


You can register a BroadcastReceiver using Intent.ACTION_PACKAGE_ADDED (and also Intent.ACTION_PACKAGE_REMOVED and/or Intent.ACTION_PACKAGE_CHANGED if necessary). For instance,

void registerReceiver() {
    IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);

public void onReceive(Context context, Intent intent) {
    final String action = intent.getAction();

    if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {
        Uri data = intent.getData();
        String pkgName = data.getEncodedSchemeSpecificPart();

    /* etc. */

Need Your Help

Messages sent in a distributed system

networking process distributed rounding

Suppose we have n processes forming a general network. We don't know which are connected together, but we know the number of the processes (n).If at each round, a process sends a message to all pro...

Long app startup times (java), maybe using Slim3 to improve?


I'm getting close to completing an app engine project (java + jdo), and am a bit worried about startup times. When the app is 'cold', it can take a long time for app engine to load my app (more tha...