In my Activity I send EventBus
@Override
protected void onResume() {
super.onResume();
EventBus.getDefault().post(new String("We are the champions"));
}
In my background service I register EventBus and try to get sent message from Activity like this
@Override
public void onCreate() {
super.onCreate();
EventBus.getDefault().register(this);
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
public void onEventBackgroundThread(String s){
Log.d(TAG, "onEventBackgroundThread: " + s);
}
But nothing happens. I tried to search internet but couldn't get answer.
Errors I get
No subscribers registered for event class java.lang.String
No subscribers registered for event class de.greenrobot.event.NoSubscriberEvent
1.Edit
I already have EventBus communication from Service to Activity. But now I want to have it also to work in reverse direction(From Activity to Service). So is it possible that it conflicts?