title: BroadcastReceiver not receiving
body: <p>I have read the instructions and examples in SO questions, but still unable to implement a simple BroadcastReceiver, it simply does not receive anything, can someone kindly provide some advice on the following code?</p>
  
  <p>tnx</p>
  
  <p>My activity:</p>
  
  <pre><code>public class Receiver1Activity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          IntentFilter filter = new IntentFilter(MyService.MY_ACTION);
          registerReceiver(new MyReceiver(), filter);
          Intent intent = new Intent();
          startService(intent);
      }
  }
  </code></pre>
  
  <p>My receiver:</p>
  
  <pre><code>public class MyReceiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context arg0, Intent arg1) {
          Log.i("MyReceiver", "onreceive");       
      }
  }
  </code></pre>
  
  <p>My service, which sends the broadcast:</p>
  
  <pre><code>public class MyService extends Service {
  
      public static final String MY_ACTION = "com.receiver1.myaction";
      @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
          Intent intent2 = new Intent(MY_ACTION);
          sendBroadcast(intent2);
          return START_NOT_STICKY;
      }
  
      @Override
      public IBinder onBind(Intent intent) {
          // TODO Auto-generated method stub
          return null;
      }
  
  }
  </code></pre>
  
  <p>My manifest file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.receiver1"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-sdk android:minSdkVersion="10" /&gt;
  
  &lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name" &gt;
      &lt;activity
          android:name=".Receiver1Activity"
          android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;service android:name=".MyService"&gt;&lt;/service&gt;
  &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>