とIntentService
主な違いはService
メインスレッド上で動作IntentService
がいない間、私たちはどちらかstopService()
かstopSelf()
がService
を停止するために呼び出す必要がありながら、作業が行われ、後者仕上げそのものです。JobIntentServiceはJobServiceにどのように関連していますか? <code>Service</code>の場合
これらの両方は、単にstartService()
に渡すことができます。
JobService
およびJobIntentService
について
は、以下のコードスニペットを見てみましょう:
JobInfo job = new JobInfo.Builder(id, new ComponentName(context, ExampleJobService.class))
.build();
JobScheduler scheduler = (JobScheduler) context
.getSystemService(Context.JOB_SCHEDULER_SERVICE);
scheduler.schedule(job);
はJobService
とJobIntentService
の両方にExampleJobService.class
を参照してくださいことはできますか?
この動作は、Service
とIntentService
と同じです(JobScheduler
はすぐにジョブを開始できない場合があります)。
JobIntentServiceは別のスレッドで実行されますか? –
**アレキサンダーファーバー**、上記[DOC](https://developer.android.com/reference/android/support/v4/app/JobIntentService.html#onHandleWork%28android.content.Intent%29) 'onHandleWork 'バックグラウンドスレッドで動作する – user2650128