JobIntentService#onHandleWork
代码
Intent intent1 = new Intent();
intent1.setAction(intent.getAction());
intent1.putExtra(Intent.EXTRA_INTENT, intent);
enqueueWork(context, ManagerJobIntentService.class, JOB_ID, workIntent);
覆盖onStartCommand()
@Override
public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
return(START_REDELIVER_INTENT);
}
onHandleWork()
@Override
protected void onHandleWork(@NonNull Intent intent) {
LogUtil.d(TAG, "onHandleWork() method " + intent);
}
以上代码运行正常!重新启动后,未调用设备onHandleWork()
设备:三星s9,s8(Android 9)