title: EventBus comunication between activity and service
body: <p>I'm working on an Android application with EventBus library. I have an activity and a service. I want to to fire an event from activity and receive it on service.</p>
  
  <p>The activity is:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      public static final String TAG="ACTIVITY";
  
      @Subscribe(threadMode = ThreadMode.MAIN)
      public void onMessageEvent(StartEvent event) {
          Log.d(TAG, "Received message");
          Snackbar.make(fab, "Stop task", Snackbar.LENGTH_LONG).show();
          txtMessage.setText(event.message);
      };
  
      FloatingActionButton fab;
  
  
      TextView txtMessage;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          txtMessage=findViewById(R.id.txtMessage);
          fab = (FloatingActionButton) findViewById(R.id.fab);
          fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Snackbar.make(view, "Start background process", Snackbar.LENGTH_LONG)
                          .setAction("Action", null).show();
                  txtMessage.setText("Begin");
                  Log.d(TAG,Thread.currentThread().getName()+ " ");
                  EventBus.getDefault().post(new StartEvent());
              }
          });
      }
  
      @Override
      protected void onPause() {
          EventBus.getDefault().unregister(this);
          super.onPause();
      }
  
      @Override
      protected void onResume() {
          // registriamo un receiver per ricevere una notifica alla fine del servizio in background
          EventBus.getDefault().register(this);
          super.onResume();
      }
  
  
  }
  </code></pre>
  
  <p>The service is:</p>
  
  <pre><code>public class MyService extends Service {
      public static final String TAG="SERVICE";
  
      public MyService() {
      }
  
      @Nullable
      @Override
      public IBinder onBind(Intent intent) {
          return null;
      }
  
      @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
          return START_STICKY_COMPATIBILITY;
      }
  
      @Override
      public void onCreate() {
          super.onCreate();
          EventBus.getDefault().register(this);
  
      }
  
      @Override
      public void onDestroy() {
          EventBus.getDefault().unregister(this);
          super.onDestroy();
      }
  
      @Subscribe
      public void onEvent(StartEvent event){
          Log.d(TAG, "BEGIN process in background su thread "+Thread.currentThread().getName());
  
          try {
              Thread.sleep(10000);
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          Log.d(TAG, "END processo in background su thread "+Thread.currentThread().getName());
  
          MessageEvent message=new MessageEvent();
          message.message="Operazione in background terminata!";
          EventBus.getDefault().post(message);
      }
  
  }
  </code></pre>
  
  <p>The manifest is:</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.example.myapplication6"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name"
              android:theme="@style/AppTheme.NoActionBar"&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"
              android:enabled="true"
              android:exported="true"&gt;&lt;/service&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>When i press button on activity to start background task, EventBus show me the following message on logcat:</p>
  
  <pre><code>ACTIVITY: main 
  EventBus: No subscribers registered for event class xx.StartEvent
  EventBus: No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent
  </code></pre>
  
  <p>What is wrong?</p>