title: Start an Activity on Phone Boot in Android
body: <p>I want to start my application automatically when the phone boots.
  I declared a BroadcastReceiver in the manifest file.</p>
  
  <pre><code>&lt;receiver android:name=".Autostart"&gt;  
  &lt;intent-filter&gt;  
      &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;  
  &lt;/intent-filter&gt;  
  </code></pre>
  
  <p> </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
  </code></pre>
  
  <p>I made a java file for the receiver. </p>
  
  <p>Autostart.java</p>
  
  <pre><code>public class Autostart extends BroadcastReceiver {
  @Override
  public void onReceive(Context context, Intent intent) {
      if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {  
  
      Intent pushIntent = new Intent(context, MushTouchActivity.class); 
      pushIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      context.startActivity(pushIntent);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But, the application does not launch when I switch my phone on. Can anyone tell me what I am missing here ?</p>