title: Is there a method to listen and detect installation and uninstallations?
body: <p>I'm trying to build a launcher in Android Studio and I am using a RecyclerView </p>
  
  <p>You know, when an app is installed, it is automatically added to the launcher menu. Similarly, when an app is removed, it is removed from the view. </p>
  
  <p>Which method should be used to make this happen? Now, list is updated every time the view is created:</p>
  
  <pre class="lang-java prettyprint-override"><code>public ArrayList&lt;AppInfo&gt; getAppInfo(){
          ArrayList &lt;AppInfo&gt; appsList = new ArrayList&lt;&gt;();
          PackageManager pm = getPackageManager();
          Intent i = new Intent(Intent.ACTION_MAIN, null);
          i.addCategory(Intent.CATEGORY_LAUNCHER);
  
          List&lt;ResolveInfo&gt; allApps = pm.queryIntentActivities(i, 0);
          for(ResolveInfo ri:allApps) {
              AppInfo app = new AppInfo();
              app.label = ri.loadLabel(pm);
              app.packageName = ri.activityInfo.packageName;
              app.icon = ri.activityInfo.loadIcon(pm);
              appsList.add(app);
              System.out.println(app.label);
  
          }
          return appsList;
      }
  </code></pre>