Comment 'binder' un service de manière synchrone ?
Bonjour,
J'ai le code suivant mais il bloque et ne passe même pas par la méthode onServiceConnected().
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| @Override
public void onServiceConnected(ComponentName className, IBinder service) {
sgsBinder = (SGS.SGSBinder) service;
Log.e("binding", "binding ok");
synchronized (bindingLock) {
bindingLock.notify();
}
isSGSBound = true;
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| @Override
public void onStart() {
super.onStart();
bindService(sgsIntent, sgsConnection, Context.BIND_AUTO_CREATE);
synchronized (bindingLock) {
Log.e("binding", "starting to wait");
try {
bindingLock.wait();
} catch (InterruptedException e) {
System.out.println("InterruptedException caught");
}
}
} |
Quelqu'un saurait-il m'indiquer d'où peut venir le problème ?
Merci d'avance pour votre aide