【发布时间】:2019-01-09 18:47:51
【问题描述】:
当拨出电话或来电发生时,我正在开始工作
Bundle bundle = new Bundle();
bundle.putString("MobileNumber", number);
bundle.putString("CallStatus", "OUT");
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(ctx));
Job myJob = dispatcher.newJobBuilder()
.setService(FirebaseRecordingService.class) // the JobService that will be called
.setTag("my-unique-tag1") // uniquely identifies the job
.setExtras(bundle)
.build();
dispatcher.mustSchedule(myJob);
这次 onStartJob 执行了 现在我在通话结束后停止工作
FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(ctx));
dispatcher.cancel("my-unique-tag1");
但这一次 onStopJob 没有执行。 谁能告诉我哪里做错了。
【问题讨论】:
-
您是否尝试过使用作业 ID 来启动和停止它?
-
@quicklearner 我如何在 FirebaseJobDispatcher 中使用作业 ID????
-
您是一次只启动一项服务还是另一种服务?
-
@quicklearner 在传入和传出时间我只启动一项服务,但还有一些其他服务执行其他任务
-
请给我一点时间
标签: android