Dúvidas sobre bindService
Tenho algumas dúvidas sobre o serviço vinculado ao Android. O guia:http://developer.android.com/guide/components/bound-services.html ,sobrebindService()
, diz:
The `bindService()` method returns immediately without a value
Mas isso não parece estar correto, poisaqui a assinatura do método é
public abstract boolean bindService (Intent service, ServiceConnection conn, int flags)
onde o valor booleano retornado é descrito abaixo:
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.
Portanto, a pergunta é: por que a documentação diz que o métodoreturns immediately without a value
? Além disso,aqui, a ligação é feita desta maneira:
void doBindService() {
bindService(new Intent(Binding.this,
LocalService.class), mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
}
e eu não entendo o sentido demIsBound = true
, uma vez que o javadoc diz que bindService () também pode retornar false, se a ligação ao serviço falhar. Então deve ser:
void doBindService() {
mIsBound = bindService(new Intent(Binding.this,
LocalService.class), mConnection, Context.BIND_AUTO_CREATE);
}
Estou errado?