public LocationServiceConnection(LocationServiceBinder binder)
 {
     if (binder == null)
     {
         return;
     }
     _binder = binder;
 }
		//This gets called when a client tries to bind to 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)
		{
			//casr the binder located by the OS as our local binder subclass
			LocationServiceBinder serviceBinder = service as LocationServiceBinder;
			if (serviceBinder != null) {
				this.binder = serviceBinder;
				this.binder.IsBound = true;
				Log.Debug ("ServiceConnection", "OnServiceConnected called");
				//Raise the service connected event
				this.ServiceConnected(this, new ServiceConnectedEventArgs() { Binder = service} );

				//Now that the service is bound, we can start gathering some location data
				serviceBinder.Service.StartLocationUpdates();
			}
		}
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            var serviceBinder = service as LocationServiceBinder;

            if (serviceBinder == null)
            {
                return;
            }
            _binder         = serviceBinder;
            _binder.IsBound = true;
            Log.Debug("Location Service Connection:", "OnServiceConnected has been called");
            ServiceConnected(this, new ServiceConnectedEventArgs()
            {
                Binder = service
            });
            serviceBinder.Service.StartLocationUpdates();
        }
Example #4
0
        // 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)
        {
            // cast the binder located by the OS as our local binder subclass
            LocationServiceBinder serviceBinder = service as LocationServiceBinder;

            if (serviceBinder != null)
            {
                this.binder         = serviceBinder;
                this.binder.IsBound = true;
                Log.Debug("ServiceConnection", "OnServiceConnected Called");
                // raise the service connected event
                this.ServiceConnected(this, new ServiceConnectedEventArgs()
                {
                    Binder = service
                });

                // now that the Service is bound, we can start gathering some location data
                serviceBinder.Service.StartLocationUpdates();
            }
        }
		public LocationServiceConnection (LocationServiceBinder binder)
		{
			if (binder != null) {
				this.binder = binder;
			}
		}