title: Android Boot-Up BroadCast Not invoking
body: <p>I am currently trying to make a broadcast receiver which will invoke after android device boots and then will run a background service. I have tried many examples but don't know where I'm going wrong. I am following this example:
  <a href="https://github.com/commonsguy/cw-advandroid/tree/master/SystemEvents/OnBoot" rel="nofollow">https://github.com/commonsguy/cw-advandroid/tree/master/SystemEvents/OnBoot</a>
  I have imported this whole project in my workspace and tried to run. But the receiver didn't invoked or so.
  Please help me out.
  <strong>My Testing Device is: Motorolla Xoom with ICS 4.0.3</strong></p>
  
  <p><strong>EDIT</strong></p>
  
  <p><strong>Manifest</strong>
  
  </p>
  
  <pre><code>&lt;uses-sdk android:minSdkVersion="8" /&gt;
  
  &lt;supports-screens
      android:anyDensity="true"
      android:largeScreens="true"
      android:normalScreens="true"
      android:smallScreens="true" /&gt;
  
  &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
  &lt;uses-permission android:name="android.permission.REBOOT" /&gt;
  
  &lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name" &gt;
      &lt;service
          android:name="awais.soft.MyService"
          android:enabled="true" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="awais.soft.MyService" &gt;
              &lt;/action&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  
      &lt;receiver android:name="awais.soft.ServicesDemoActivity" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED" &gt;
              &lt;/action&gt;
  
              &lt;category android:name="android.intent.category.HOME" &gt;
              &lt;/category&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Broadcast Receiver</strong></p>
  
  <pre><code>package awais.soft;
  
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.util.Log;
  import android.view.Menu;
  
  public class ServicesDemoActivity extends BroadcastReceiver {
  
  static final int idBut = Menu.FIRST + 1, idIntentID = Menu.FIRST + 2;
  
  @Override
  public void onReceive(Context context, Intent intent) {
  
      Log.e("Awais", "onReceive:");
      if (intent.getAction().equals(Intent.ACTION_POWER_CONNECTED)) {
          Intent i = new Intent();
          i.setAction("awais.kpsoft.MyService");
          context.startService(i);
  
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Service</strong></p>
  
  <pre><code>package awais.soft;
  
  import android.app.Service;
  import android.content.Intent;
  import android.media.MediaPlayer;
  import android.os.IBinder;
  import android.util.Log;
  import android.widget.Toast;
  
  public class MyService extends Service {
  private static final String TAG = "MyService";
  MediaPlayer player;
  
  @Override
  public IBinder onBind(Intent intent) {
      return null;
  }
  
  @Override
  public void onCreate() {
      Toast.makeText(this, "My Service Created", Toast.LENGTH_LONG).show();
      Log.d(TAG, "onCreate");
  
      player = MediaPlayer.create(this, R.raw.is);
      player.setLooping(false); // Set looping
  }
  
  @Override
  public void onDestroy() {
      Toast.makeText(this, "My Service Stopped", Toast.LENGTH_LONG).show();
      Log.d(TAG, "onDestroy");
      player.stop();
  }
  
  @Override
  public void onStart(Intent intent, int startid) {
      Toast.makeText(this, "My Service Started", Toast.LENGTH_LONG).show();
      Log.d(TAG, "onStart");
      player.start();
  }
  </code></pre>
  
  <p>}</p>