如何使用firebase jobdispatcher绑定服务JobService

时间:2017-08-13 19:36:34

标签: android firebase-job-dispatcher

我想像textview一样更新我的UI组件,但localbinder,onbind,onStartCommand是jodispatcher库中jobservice的最终版本,这样我就可以在我的活动中实现绑定服务,就像下面的代码一样:

    /** Defines callbacks for service binding, passed to bindService() */
    private ServiceConnection mConnection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName className,
                IBinder service) {
            // We've bound to LocalService, cast the IBinder and get LocalService instance
            LocalBinder binder = (LocalBinder) service;
            mService = binder.getService();
            mBound = true;
        }

        @Override
        public void onServiceDisconnected(ComponentName arg0) {
            mBound = false;
        }
    };

0 个答案:

没有答案