I have some boubts about Android bound service. The guide: http://developer.android.com/guide/components/bound-services.html
,about bindService()
, says:
The `bindService()` method returns immediately without a value
But this does not seems to be correct, since here the signature of the method is
public abstract boolean bindService (Intent service, ServiceConnection conn, int flags)
where the returned boolean value is described as below:
If you have successfully bound to the service, true is returned; false is returned if the connection is not made so you will not receive the service object.
So the question is: why the documentation says that the method returns immediately without a value
? Moreover, here, the bind is done in this way:
void doBindService() {
bindService(new Intent(Binding.this,
LocalService.class), mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
}
and I don't understand the sense of mIsBound = true
, since the javadoc says that bindService() can also return false, if the bounding to service fail. So it should be:
void doBindService() {
mIsBound = bindService(new Intent(Binding.this,
LocalService.class), mConnection, Context.BIND_AUTO_CREATE);
}
Am I wrong?