Skip to content

Inside Services post / postRemote only post local #9

Description

@paulgavrikov

Code works in Activities, but inside a service both post or postRemote only post to the local event listeners.

public class WearService extends Service {
    public WearService() {
    }

    @Override
    public void onCreate() {
        super.onCreate();
        EventBus.getDefault().register(this);
    }

    public void onEvent(Long i) {
        L.e("onEvent:long "+i);
        pushToWear();
    }

    public void onEvent(String s) {
        // called after pushToWear!!!!
    }

    private void pushToWear() {
     ...
        EventBus.getDefault().postRemote(payload.toString(), this);
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions