title: How to execute methods from a running service from broadcast?
body: <p>on a broadcast I want to call a non static method from Service XYZ. The Service is start by the receiver on boot.
  Has someone a idea to run methods from this running service?
  One solution in this forum is to make the method static and use a singleton pattern to execute. But is there another method? Maybe with a binder?</p>
  
  <p>//EDIT for example i have the following clases:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class MyService extends Service{
     .....
     public void method(){
        //TODO
     }
  }
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class MyBroadcastReceiver extends BroadcastReceiver{
     .....
    public void onReceive(Context context, Intent intent) {
      String intentAction=intent.getAction();
      if(intentAction.equals(Intent.ACTION_BOOT_COMPLETED)){  
          //start service
          Intent serviceIntent = new Intent(context, MyService.class);
          context.startService(serviceIntent);
  
      }
      else{ 
       //TODO call method() in MyService
      }
  }
  </code></pre>
  
  <p>how can i call the method <code>method()</code>? I know that i can cast with <code>context.getSystemService()</code> system services. But how can i get my own service object?</p>
  
  <p>greetings</p>