title: BroadcastReceiver is not able to receive the Intent
body: <p>I want to write a BroadcastReceiver to receive the application install action. But it failed, so I test if my receiver is well or not. So custom a intent, it also filed. below is my code. Please help me correct it.
      public class MyInstallReceiver extends BroadcastReceiver {
  //    public MyInstallReceiver() {
  //    }</p>
  
  <pre><code>@Override
  public void onReceive(Context context, Intent intent) {
      Toast.makeText(context, "Intent Detected.", Toast.LENGTH_LONG).show();
      Log.d("receiver", "Intent Detected");
      if (intent.getAction (). equals ("android.intent.action.PACKAGE_ADDED")) {
          String packageName = intent.getDataString ();
          //System.out.println ("installed:" + packageName + "package name of the program");
          Log.d("receiver","installed:" + packageName + "package name of the program");
      }
  }
  }
  </code></pre>
  
  <p>custom  intent</p>
  
  <pre><code>public void installAPK(View v){
     startActivity(intent);
      Intent intent = new Intent();
      intent.setAction("com.tutorialspoint.CUSTOM_INTENT");
      sendBroadcast(intent);
      Log.d("receiver", "Intent sent");
  }
  </code></pre>
  
  <p>Manifest.xml</p>
  
  <pre><code>       &lt;receiver
          android:name=".MyInstallReceiver"
          android:enabled="true"
          android:exported="true" &gt;
          &lt;Intent-filter&gt;
              &lt;action   android:name = "android.intent.action.PACKAGE_ADDED"/&gt;
              &lt;action   android:name = "android.intent.action.PACKAGE_REMOVED"/&gt;
  
              &lt;action android:name="com.tutorialspoint.CUSTOM_INTENT"&gt;
              &lt;/action&gt;
              &lt;Data   android:scheme = "package"   /&gt;
          &lt;/Intent-filter&gt;
      &lt;/receiver&gt;
  
  enter code here
  </code></pre>