Onserviceconnected Not Getting Called
I referred to the following questions already but could not find an answer: Can't get service object (onServiceConnected never called), onServiceConnected not getting called , get
Solution 1:
I rewrote the service class so that onBind() returns IBinder as follwos.
publicclassPodServiceextendsService {
@Overridepublic IBinder onBind(Intent intent) {
Log.d("bound", "bound");
return mBinder; // returns IBinder object
}
privatefinalIBindermBinder=newPodSeviceStub(this);
staticclassPodSeviceStubextendsIPodService.Stub {
WeakReference<PodService> mService;
publicPodSeviceStub(PodService service) {// added a constructor for Stub here
mService = newWeakReference<PodService>(service);
}
//here i implemented unimplemented methods
}
}
and now it works.
Post a Comment for "Onserviceconnected Not Getting Called"