public ServiceConnection(ServiceBinder binder) { if (binder != null) { Binder = binder; } }
// This gets called when a client tries to bind to the Service with an Intent and an // instance of the ServiceConnection. The system will locate a binder associated with the // running Service public void OnServiceConnected(ComponentName name, IBinder service) { if (service is ServiceBinder serviceBinder) { Binder = serviceBinder; Binder.IsBound = true; ServiceConnected(this, new ServiceConnectedEventArgs { Binder = service }); } }