Getting Could not find job 999 error
See original GitHub issueYour Environment
- Plugin version: 7.0.3
- Platform: Android
- OS version: Android 11
- Device manufacturer / model: Android Emulator
- React Native version (
react-native -v
): It’s ionic cordova application. - Plugin config: { stopOnTerminate: false, startOnBoot: true, minimumFetchInterval: 15, enableHeadless: true, requiredNetworkType: BackgroundFetch.NETWORK_TYPE_ANY }
Following is the code:
import { Injectable } from '@angular/core';
import { CoreNonInjectableBase } from "../../base/core-noninjectable.base";
import { Network } from "@ionic-native/network";
import { ToastController, Platform } from "ionic-angular";
import BackgroundFetch, { BackgroundFetchConfig } from "cordova-plugin-background-fetch";
/*
Generated class for the BackgroundServiceProvider provider.
See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class BackgroundServiceProvider extends CoreNonInjectableBase {
constructor(
private network: Network,
private platform: Platform,
private backgroundFetch: BackgroundFetch
) {
super();
this.platform.ready().then(result => {
//if (this.platform.is('ios') || this.platform.is('android')) {
localStorage.setItem('success schedule task', 'init');
this.onDeviceReady.bind(this)
//}
});
}
async onDeviceReady() {
let config: BackgroundFetchConfig = {
stopOnTerminate: false,
startOnBoot: true,
minimumFetchInterval: 15,
enableHeadless: true,
requiredNetworkType: BackgroundFetch.NETWORK_TYPE_ANY
}
console.log('device on ready in Background service');
// Your BackgroundFetch event handler.
let onEvent = async (taskId) => {
localStorage.setItem('[BackgroundFetch] event received 121212: ', taskId);
// Required: Signal completion of your task to native code
// If you fail to do this, the OS can terminate your app
// or assign battery-blame for consuming too much background-time
await BackgroundFetch.finish(taskId);
};
// Timeout callback is executed when your Task has exceeded its allowed running-time.
// You must stop what you're doing immediately BackgroundFetch.finish(taskId)
let onTimeout = async (taskId) => {
localStorage.setItem('[BackgroundFetch] TIMEOUT: ', taskId);
await BackgroundFetch.finish(taskId);
};
// Configure the plugin.
let status = await BackgroundFetch.configure(config, onEvent, onTimeout);
console.log('[BackgroundFetch] configure, status: ', status);
await BackgroundFetch.scheduleTask({
taskId: "com.transistorsoft.downloadWalkthroughData",
forceAlarmManager: true,
delay: 6 * 1000,
periodic: true// <-- milliseconds
});
}
makeServerCall() {
}
}
Expected Behavior
When I terminate application from multitasker then and when I run jobschedular command then it should show log from headless java file.
Actual Behavior
see logs.
Steps to Reproduce
Context
My ionic app works offline and I am using sqlite db in it, so I am trying to pre-download some app data from my web api and store that in sqlite in advance so that users can perform actions without worrying about internet connection.
Debug logs
adb shell cmd jobscheduler run -f com.my.app 999 output: Could not find job 999 in package com.my.app / user 0
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Flutter Background_fetch lib does not run after terminating app
I'm simulating job with this command: adb shell cmd jobscheduler run -f com.mycompany.appname 999 . When app is active or it's in foreground,...
Read more >getting error Cannot find a 'job started' record in the log - IBM
When trying to run a DataStage job that previously failed - getting error Cannot find a 'job started' record in the log.
Read more >800 - 999 Error Codes - FairCom
Value Symbolic Constant Explanation
800 TDEP_ERR TRANDEP file operation pending.
801 FBLK_PND Trying to set file block; leave core.
802 FBLK_SUP File block not supported for...
Read more >System Error Codes (500-999) (WinError.h) - Win32 apps
{Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly. The relocation occurred ...
Read more >Desktop Underwriter Credit-related Error Codes Job Aid
Note: Typically means that the credit agency could not find the borrower data. • Compare the borrower's information on the credit report with ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think you understand what JavaScript
Function.bind
does.It doesn’t actually execute
onDeviceReady
, it returns anotherFunction
with its scope changed.And in the meantime, be aware that your
onDeviceReady
is NOT executing, thusBackgroundFetch.configure
is not even being executed, which is why you seeCould not find job 999 in package com.my.app / user 0
.