I am trying to add extras
to my JobInfo.Builder
supporting Android API 23 and higher. Thing is when adding Bundle
to builder
then I need to do builder.setTransientExtras
.
ComponentName serviceComponent = new ComponentName(context, RestApiJobService.class);
JobInfo.Builder builder = new JobInfo.Builder(getUniqueJobId(), serviceComponent);
builder.setTransientExtras(RestApiJobFactory.save(jobItem);
The issue here is that builder.setTransientExtras
is only supported in API 26 and higher. And builder.setExtras
only supports PersistableBundle
. And I need it to support Bundle
since I have Files
in my Bundle
.
Is there any workaround to support builder.setTransientExtras
in Android 23 and also the same for getTransientExtras
.
Or maybe there is a way to use Bundle with bundle.setExtras()
.