title: Android Service not binding?
body: <p>I have an android kotlin application that is trying to bind to a service.  My main activity looks like this:</p>
  
  <pre><code>class MainActivity : AppCompatActivity(), View.OnClickListener, DevicesRecyclerViewAdapter.ItemClickListener {
  
  private var  mMyService: MyService? = null
  private var isBind = false
  private lateinit var mServiceConnection: ServiceConnection
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      mServiceConnection = object : ServiceConnection {
          override fun onServiceConnected(componentName: ComponentName, service: IBinder) {
  
              mMyService = (service as MyService.LocalBinder).getService()
          }
  
          override fun onServiceDisconnected(componentName: ComponentName) {
              mMyService = null
          }
  
      }
      initService()
  
   }
  
  fun initService() {
  
          if (!isBind) {
              val gattServiceIntent = Intent(this, MyService::class.java)
                 bindService(gattServiceIntent, mServiceConnection,
                      Context.BIND_AUTO_CREATE)
              isBind = true
  
          }
     }
  
  }
  </code></pre>
  
  <p>And the service itself looks like this:</p>
  
  <pre><code>class MyService : Service() {
  
  var mBinder: IBinder = LocalBinder()
  
  override fun onBind(p0: Intent?): IBinder? {
     return mBinder
  }
  
   inner class LocalBinder : Binder(){
     internal fun getService(): MyService {
       return this@MyService
     }
   }
  
  }
  </code></pre>
  
  <p>However the code never seems to get to onServiceConnected.  Am I missing something?  Thanks!</p>