title: Simplest/shortest/cheapest way to send a signal from service to activity
body: <p>I have a music player with a MusicService that runs the player and notification, and a Player activity for UI. I want the <code>Player</code> to react to very simple signals sent by the <code>MusicService</code>, like &quot;song ended&quot;, or react to notification button presses.</p>
  <p>The way I've done this is via Broadcasts in the service:</p>
  <pre><code>            mplayer = MediaPlayer.create(c, Uri.parse(filename));
              mplayer.setOnCompletionListener(mp -&gt; {
                  sendBroadcast(new Intent(&quot;MyXVFPlayer-SongFinished&quot;));
              });
  </code></pre>
  <p>and then in <code>Player</code>:</p>
  <pre><code>private class DataUpdateReceiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();
          if (action != null) {
              if (action.equals(&quot;MyXVFPlayer-SongFinished&quot;)) {
                  nextsong();
              }
              ...
          }
      }
  }
  </code></pre>
  <p>This works perfectly, but then I've read that Broadcasts are overkill for this. Better a LocalBroadcast. But now it is deprecated. So LiveData. But maybe a Messenger. Or an EventBus. Or a service as a singleton. Or...??</p>
  <p>So I am very confused now. I have no idea which is the cheapest (less resource intensive) way. In September 2021, that is...</p>
  <p>Any advice?</p>