public void bind ( ) { if ( serviceObject != null ) { return ; } final Context context = contextRef . get ( ) ; if ( context == null ) { return ; } // TODO make it configurable final Intent intent = new Intent ( context , GoroService . class ) ; intent . setAction ( getInterfaceClass ( ) . getName ( ) ) ; if ( DEBUG_CALLS ) { Log . v ( TAG , "Attempt to bind to service " + this + "/" + context , new RuntimeException ( ) ) ; } // start manually, so that it will be stopped manually context . startService ( intent ) ; final boolean bindResult = context . bindService ( intent , this , 0 ) ; if ( DEBUG ) { Log . v ( TAG , "Binded to service: " + bindResult + ", " + context + ", interface: " + getInterfaceClass ( ) ) ; } }
Create the service connection .