title: Detecting App Installation
body: <p>Edit: Managed to solve it. Created a new project, cleared app data before uninstalling it, re-installed it, and it magically worked. Thanks for the help.</p>
  
  <p>I'm trying to detect when an app is installed, but I'm not quite sure where I am going wrong. I've checked several questions on here, but I just can't seem to figure it out. I'm pretty new to android, so I may have missed something obvious. Here is the test case of what I have. </p>
  
  <p>I installed it to my phone, and the process and service is shown as running in the settings. Then, I download an app from the play store, check the logcat, and there is nothing from the app. </p>
  
  <p>Any help on where I'm going wrong? Thanks.</p>
  
  <p>Edit:</p>
  
  <p>After playing with it some more, I have some new example test code. When a new package is installed, the onReceive method doesn't fire. However, as I was testing things out, I added a constructor to the BroadcastReceiver class, and the constructor fires everytime a package is installed. So, it seems to be receiving the intent, but the log inside the onReceive never seems to print out. Any ideas?</p>
  
  <pre><code>public class InstallReceiver extends BroadcastReceiver {
  
      public InstallReceiver()
      {
          //This log will display in the logcat
          Log.d("InstallReceiver", "InstallReceiver constructor called.");
      }
      @Override
      public void onReceive(Context context, Intent intent) {
          //This log never displays if the constructor is in or commented out
          Log.d("InstallReceiver", "Install detected.");
      }
  
  }
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;receiver android:name=".InstallReceiver"&gt;
              &lt;intent-filter &gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;action android:name="android.intent.action.PACKAGE_ADDED"  /&gt;
              &lt;action android:name="android.intent.action.PACKAGE_CHANGED" /&gt;
              &lt;action android:name="android.intent.action.PACKAGE_INSTALL" /&gt;
              &lt;action android:name="android.intent.action.PACKAGE_REMOVED" /&gt;
              &lt;action android:name="android.intent.action.PACKAGE_REPLACED" /&gt;
              &lt;data android:scheme="package" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  </code></pre>