title: How to bind Service if it's in another process?
body: <p>Manifest:</p>
  
  <pre><code> &lt;service android:name="com.example.MainService" android:process=":main_service"/&gt;
  </code></pre>
  
  <p>Trying to bind service in Activity:</p>
  
  <pre><code>public class MainActivity extends Activity {
      MainService mMainService;
  
      private boolean mBound;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          bindService(intentForMainService, mConnection, Context.BIND_AUTO_CREATE)
      }
  
      private ServiceConnection mConnection = new ServiceConnection() {
          public void onServiceConnected(ComponentName className,
                                         IBinder service) {
              MainService.MainServiceBinder binder = (MainService.MainServiceBinder) service;//HERE IS EXCEPTION
              mMainService = (MainService) binder.getService();
              mBound = true;
          }
  
          public void onServiceDisconnected(ComponentName className) {
              mMainService = null;
              mBound = false;
          }
      };
  
      @Override
      protected void onStop() {
          doUnbindService();
          super.onStop();
      }
  
      void doUnbindService() {
          if (mBound) {
            unbindService(mConnection);
          }
      }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>    FATAL EXCEPTION: main
   Process: com.hos.android, PID: 9001
     java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.example.service.main.MainService$MainServiceBinder
     at com.example.ui.base.BaseServiceActivity$1.onServiceConnected(MainActivity.java:34)
     at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1335)
     at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1352)
     at android.os.Handler.handleCallback(Handler.java:739)
     at android.os.Handler.dispatchMessage(Handler.java:95)
     at android.os.Looper.loop(Looper.java:158)
     at android.app.ActivityThread.main(ActivityThread.java:7224)
  </code></pre>
  
  <p>But when I delete this <strong>android:process=":main_service"</strong> all works properly</p>