Job Scheduler and WorkManager are destroyed when the app is killed The 2019 Stack Overflow Developer Survey Results Are InJob scheduler stops working if app killed androidJob Scheduler doesn't work if app is killedDoes Job scheduler api work when app is killed?Schedule a work on a specific time with WorkManagerAndroidX WorkManager - “how to” make a scheduled job persistent?Check if WorkManager is scheduled alreadyAndroid workmanager scheduled worker lost after task killedWorkManager adding too many jobs to JobSchedulerIs it possible schedule events(GPS On/Off, Wifi On?Off) in workmanager?WorkManager - how to execute jobs sequentially

Getting crown tickets for Statue of Liberty

Why did Peik say, "I'm not an animal"?

What force causes entropy to increase?

Are there any other methods to apply to solving simultaneous equations?

Pokemon Turn Based battle (Python)

Is an up-to-date browser secure on an out-of-date OS?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

Short story: man watches girlfriend's spaceship entering a 'black hole' (?) forever

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

"as much details as you can remember"

Keeping a retro style to sci-fi spaceships?

Kerning for subscripts of sigma?

How can I add encounters in the Lost Mine of Phandelver campaign without giving PCs too much XP?

Did any laptop computers have a built-in 5 1/4 inch floppy drive?

Can withdrawing asylum be illegal?

What do these terms in Caesar's Gallic Wars mean?

Output the Arecibo Message

What do I do when my TA workload is more than expected?

How to notate time signature switching consistently every measure

Ubuntu Server install with full GUI

Is there a way to generate a uniformly distributed point on a sphere from a fixed amount of random real numbers?

Finding the area between two curves with Integrate

A female thief is not sold to make restitution -- so what happens instead?

Likelihood that a superbug or lethal virus could come from a landfill



Job Scheduler and WorkManager are destroyed when the app is killed



The 2019 Stack Overflow Developer Survey Results Are InJob scheduler stops working if app killed androidJob Scheduler doesn't work if app is killedDoes Job scheduler api work when app is killed?Schedule a work on a specific time with WorkManagerAndroidX WorkManager - “how to” make a scheduled job persistent?Check if WorkManager is scheduled alreadyAndroid workmanager scheduled worker lost after task killedWorkManager adding too many jobs to JobSchedulerIs it possible schedule events(GPS On/Off, Wifi On?Off) in workmanager?WorkManager - how to execute jobs sequentially



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Trying to put video compression in background but app gets killed WorkManager and JobSchedular Destroyed



how to solve this issue?



if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) 
ComponentName componentName = new ComponentName(ConcatVideoActivity.this, ConcatVideoJobServiceRepository.class);
JobInfo jobInfo;
PersistableBundle bundle = new PersistableBundle();
bundle.putString(FIRST_IMG, doctorCredentialModel.getDoctorFrontimg().replaceAll(" ", "%20"));
bundle.putString(LAST_IMG, doctorCredentialModel.getDoctorBackimg().replaceAll(" ", "%20"));
bundle.putString(VIDEO_URL, doctorCredentialModel.getVidUrl());
if(doctorCredentialModel.getDoctorName()!=null)
bundle.putString(DR_NAME, doctorCredentialModel.getDoctorName());
else
bundle.putString(DR_NAME,getString(R.string.app_name));


if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();
else
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();

try
JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
int resultCode = jobScheduler.schedule(jobInfo);
if (resultCode == JobScheduler.RESULT_SUCCESS)
Log.d("JOB SECHEDULED", "Job scheduled!");

else
Log.d("JOB NOT SECHEDULED", "Job not scheduled");



catch (Exception e)
e.printStackTrace();






@Override
public boolean onStartJob(JobParameters jobParameters)
Log.d(TAG, "Job started!");

firstImg = jobParameters.getExtras().getString(FIRST_IMG);
secondImg = jobParameters.getExtras().getString(LAST_IMG);
videoUrl = jobParameters.getExtras().getString(VIDEO_URL);
drName = jobParameters.getExtras().getString(DR_NAME);
loadFFMpegBinary(jobParameters);
isWorking = true;
// We need 'jobParameters' so we can call 'jobFinished'
// startConcatVideo(jobParameters); // Services do NOT run on a separate thread
Toast.makeText(this, "Video Customization InProgress ", Toast.LENGTH_SHORT).show();
return isWorking;










share|improve this question
























  • Give us some code sample so we can help you. How you start the JobSchedule? Is there a JobService?

    – Christos Themelis
    Mar 8 at 11:12











  • Yes, using jobService

    – Rohit Mhatre
    Mar 8 at 11:23











  • What are the circumstances of app being killed? User swiping it away from recents? Aggressive system memory saving?

    – Pawel
    Mar 8 at 11:27












  • while swiping, i have also enable auto start option

    – Rohit Mhatre
    Mar 8 at 11:29











  • First of all, you are setting persisted to true that means the job will be written to disk and loaded at boot. You don't need this. Remove this and inform us if it works. Or else we will continue searching for your solution

    – Christos Themelis
    Mar 8 at 11:31


















0















Trying to put video compression in background but app gets killed WorkManager and JobSchedular Destroyed



how to solve this issue?



if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) 
ComponentName componentName = new ComponentName(ConcatVideoActivity.this, ConcatVideoJobServiceRepository.class);
JobInfo jobInfo;
PersistableBundle bundle = new PersistableBundle();
bundle.putString(FIRST_IMG, doctorCredentialModel.getDoctorFrontimg().replaceAll(" ", "%20"));
bundle.putString(LAST_IMG, doctorCredentialModel.getDoctorBackimg().replaceAll(" ", "%20"));
bundle.putString(VIDEO_URL, doctorCredentialModel.getVidUrl());
if(doctorCredentialModel.getDoctorName()!=null)
bundle.putString(DR_NAME, doctorCredentialModel.getDoctorName());
else
bundle.putString(DR_NAME,getString(R.string.app_name));


if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();
else
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();

try
JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
int resultCode = jobScheduler.schedule(jobInfo);
if (resultCode == JobScheduler.RESULT_SUCCESS)
Log.d("JOB SECHEDULED", "Job scheduled!");

else
Log.d("JOB NOT SECHEDULED", "Job not scheduled");



catch (Exception e)
e.printStackTrace();






@Override
public boolean onStartJob(JobParameters jobParameters)
Log.d(TAG, "Job started!");

firstImg = jobParameters.getExtras().getString(FIRST_IMG);
secondImg = jobParameters.getExtras().getString(LAST_IMG);
videoUrl = jobParameters.getExtras().getString(VIDEO_URL);
drName = jobParameters.getExtras().getString(DR_NAME);
loadFFMpegBinary(jobParameters);
isWorking = true;
// We need 'jobParameters' so we can call 'jobFinished'
// startConcatVideo(jobParameters); // Services do NOT run on a separate thread
Toast.makeText(this, "Video Customization InProgress ", Toast.LENGTH_SHORT).show();
return isWorking;










share|improve this question
























  • Give us some code sample so we can help you. How you start the JobSchedule? Is there a JobService?

    – Christos Themelis
    Mar 8 at 11:12











  • Yes, using jobService

    – Rohit Mhatre
    Mar 8 at 11:23











  • What are the circumstances of app being killed? User swiping it away from recents? Aggressive system memory saving?

    – Pawel
    Mar 8 at 11:27












  • while swiping, i have also enable auto start option

    – Rohit Mhatre
    Mar 8 at 11:29











  • First of all, you are setting persisted to true that means the job will be written to disk and loaded at boot. You don't need this. Remove this and inform us if it works. Or else we will continue searching for your solution

    – Christos Themelis
    Mar 8 at 11:31














0












0








0








Trying to put video compression in background but app gets killed WorkManager and JobSchedular Destroyed



how to solve this issue?



if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) 
ComponentName componentName = new ComponentName(ConcatVideoActivity.this, ConcatVideoJobServiceRepository.class);
JobInfo jobInfo;
PersistableBundle bundle = new PersistableBundle();
bundle.putString(FIRST_IMG, doctorCredentialModel.getDoctorFrontimg().replaceAll(" ", "%20"));
bundle.putString(LAST_IMG, doctorCredentialModel.getDoctorBackimg().replaceAll(" ", "%20"));
bundle.putString(VIDEO_URL, doctorCredentialModel.getVidUrl());
if(doctorCredentialModel.getDoctorName()!=null)
bundle.putString(DR_NAME, doctorCredentialModel.getDoctorName());
else
bundle.putString(DR_NAME,getString(R.string.app_name));


if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();
else
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();

try
JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
int resultCode = jobScheduler.schedule(jobInfo);
if (resultCode == JobScheduler.RESULT_SUCCESS)
Log.d("JOB SECHEDULED", "Job scheduled!");

else
Log.d("JOB NOT SECHEDULED", "Job not scheduled");



catch (Exception e)
e.printStackTrace();






@Override
public boolean onStartJob(JobParameters jobParameters)
Log.d(TAG, "Job started!");

firstImg = jobParameters.getExtras().getString(FIRST_IMG);
secondImg = jobParameters.getExtras().getString(LAST_IMG);
videoUrl = jobParameters.getExtras().getString(VIDEO_URL);
drName = jobParameters.getExtras().getString(DR_NAME);
loadFFMpegBinary(jobParameters);
isWorking = true;
// We need 'jobParameters' so we can call 'jobFinished'
// startConcatVideo(jobParameters); // Services do NOT run on a separate thread
Toast.makeText(this, "Video Customization InProgress ", Toast.LENGTH_SHORT).show();
return isWorking;










share|improve this question
















Trying to put video compression in background but app gets killed WorkManager and JobSchedular Destroyed



how to solve this issue?



if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) 
ComponentName componentName = new ComponentName(ConcatVideoActivity.this, ConcatVideoJobServiceRepository.class);
JobInfo jobInfo;
PersistableBundle bundle = new PersistableBundle();
bundle.putString(FIRST_IMG, doctorCredentialModel.getDoctorFrontimg().replaceAll(" ", "%20"));
bundle.putString(LAST_IMG, doctorCredentialModel.getDoctorBackimg().replaceAll(" ", "%20"));
bundle.putString(VIDEO_URL, doctorCredentialModel.getVidUrl());
if(doctorCredentialModel.getDoctorName()!=null)
bundle.putString(DR_NAME, doctorCredentialModel.getDoctorName());
else
bundle.putString(DR_NAME,getString(R.string.app_name));


if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();
else
jobInfo = new JobInfo.Builder(12, componentName)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)
.setExtras(bundle)
.build();

try
JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
int resultCode = jobScheduler.schedule(jobInfo);
if (resultCode == JobScheduler.RESULT_SUCCESS)
Log.d("JOB SECHEDULED", "Job scheduled!");

else
Log.d("JOB NOT SECHEDULED", "Job not scheduled");



catch (Exception e)
e.printStackTrace();






@Override
public boolean onStartJob(JobParameters jobParameters)
Log.d(TAG, "Job started!");

firstImg = jobParameters.getExtras().getString(FIRST_IMG);
secondImg = jobParameters.getExtras().getString(LAST_IMG);
videoUrl = jobParameters.getExtras().getString(VIDEO_URL);
drName = jobParameters.getExtras().getString(DR_NAME);
loadFFMpegBinary(jobParameters);
isWorking = true;
// We need 'jobParameters' so we can call 'jobFinished'
// startConcatVideo(jobParameters); // Services do NOT run on a separate thread
Toast.makeText(this, "Video Customization InProgress ", Toast.LENGTH_SHORT).show();
return isWorking;







android android-jobscheduler android-workmanager






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 12:51









Fantômas

32.9k156491




32.9k156491










asked Mar 8 at 11:09









Rohit MhatreRohit Mhatre

11




11












  • Give us some code sample so we can help you. How you start the JobSchedule? Is there a JobService?

    – Christos Themelis
    Mar 8 at 11:12











  • Yes, using jobService

    – Rohit Mhatre
    Mar 8 at 11:23











  • What are the circumstances of app being killed? User swiping it away from recents? Aggressive system memory saving?

    – Pawel
    Mar 8 at 11:27












  • while swiping, i have also enable auto start option

    – Rohit Mhatre
    Mar 8 at 11:29











  • First of all, you are setting persisted to true that means the job will be written to disk and loaded at boot. You don't need this. Remove this and inform us if it works. Or else we will continue searching for your solution

    – Christos Themelis
    Mar 8 at 11:31


















  • Give us some code sample so we can help you. How you start the JobSchedule? Is there a JobService?

    – Christos Themelis
    Mar 8 at 11:12











  • Yes, using jobService

    – Rohit Mhatre
    Mar 8 at 11:23











  • What are the circumstances of app being killed? User swiping it away from recents? Aggressive system memory saving?

    – Pawel
    Mar 8 at 11:27












  • while swiping, i have also enable auto start option

    – Rohit Mhatre
    Mar 8 at 11:29











  • First of all, you are setting persisted to true that means the job will be written to disk and loaded at boot. You don't need this. Remove this and inform us if it works. Or else we will continue searching for your solution

    – Christos Themelis
    Mar 8 at 11:31

















Give us some code sample so we can help you. How you start the JobSchedule? Is there a JobService?

– Christos Themelis
Mar 8 at 11:12





Give us some code sample so we can help you. How you start the JobSchedule? Is there a JobService?

– Christos Themelis
Mar 8 at 11:12













Yes, using jobService

– Rohit Mhatre
Mar 8 at 11:23





Yes, using jobService

– Rohit Mhatre
Mar 8 at 11:23













What are the circumstances of app being killed? User swiping it away from recents? Aggressive system memory saving?

– Pawel
Mar 8 at 11:27






What are the circumstances of app being killed? User swiping it away from recents? Aggressive system memory saving?

– Pawel
Mar 8 at 11:27














while swiping, i have also enable auto start option

– Rohit Mhatre
Mar 8 at 11:29





while swiping, i have also enable auto start option

– Rohit Mhatre
Mar 8 at 11:29













First of all, you are setting persisted to true that means the job will be written to disk and loaded at boot. You don't need this. Remove this and inform us if it works. Or else we will continue searching for your solution

– Christos Themelis
Mar 8 at 11:31






First of all, you are setting persisted to true that means the job will be written to disk and loaded at boot. You don't need this. Remove this and inform us if it works. Or else we will continue searching for your solution

– Christos Themelis
Mar 8 at 11:31













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061973%2fjob-scheduler-and-workmanager-are-destroyed-when-the-app-is-killed%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061973%2fjob-scheduler-and-workmanager-are-destroyed-when-the-app-is-killed%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко