After hours and hours of trying to figure this out, the issue is that the examples that show the creation of the service, don't include the onBind method or they have the following sample code or it generates this for you:
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
This causes the onServiceConnected method to fail or never actually get executed. The fix is VERY simple, which is the following:
public IBinder onBind(Intent intent) {
return mBinder;
}
Where you could create a simple binder such as the following to return:
private final IBinder mBinder = new LocalBinder();
public class LocalBinder extends Binder {
public ConferenceService getService() {
return ConferenceService.this;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…