OnServiceConnected not getting called

点点圈 提交于 2019-12-01 21:43:37

I rewrote the service class so that onBind() returns IBinder as follwos.

public class PodService extends Service {
@Override
    public IBinder onBind(Intent intent) {

        Log.d("bound", "bound");
        return mBinder; // returns IBinder object
    }

    private final IBinder mBinder = new PodSeviceStub(this);

 static class PodSeviceStub extends IPodService.Stub {

         WeakReference<PodService> mService;

        public PodSeviceStub(PodService service) {// added a constructor for Stub here
            mService = new WeakReference<PodService>(service);
        }
//here i implemented unimplemented methods

    }
}

and now it works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!