BackgroundActions.stop does not terminate ongoing task
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, react-native
Direzione di ricerca
Start by reading the task lifecycle and stop implementation in the library, then trace how the task function handles completion or cancellation. The report includes a JavaScript example but no failing test or specific library files. Done means reproducing the ongoing task and confirming that calling BackgroundActions.stop terminates it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
stop not working
import BackgroundActions from 'react-native-background-actions';
import { DeviceEventEmitter } from 'react-native';
/**
* Class BackgroundTaskManager is designed to manage background tasks using
* react-native-background-actions. However, the task started by scheduleTask
* does not stop when finish is called.
*/
class BackgroundTaskManager {
static instance = null;
static iteration = 0;
static backgroundTaskId = null;
constructor() {
if (!BackgroundTaskManager.instance) {
BackgroundTaskManager.instance = this;
BackgroundTaskManager.resetInit();
console.log('BackgroundTaskManager initialized');
}
return BackgroundTaskManager.instance;
}
/**
* Resets the task manager and clears any existing background task configuration.
*/
static resetInit() {
this.configArgsiOS = null;
this.configStartFunction = null;
this.configTimeoutFunction = null;
this.task = null;
this.options = null;
this.iteration++;
console.log('BackgroundTaskManager reset');
}
/**
* Configures the task manager with provided arguments.
*/
static async configure(...args) {
BackgroundTaskManager.resetInit();
console.log('Configuring with args:', args);
this.configArgsiOS = args;
if (this.configStartFunction === null) {
this.configStartFunction = args[1];
}
this.configTimeoutFunction = args[2];
console.log('Configuration is now unified for both platforms.');
}
/**
* Schedules a new background task. The task does not stop as expected when
* the finish method is called.
*/
static async scheduleTask(...args) {
const { taskId } = args[0];
console.log('Scheduling task with args:', args);
// Task scheduling options
this.options = {
// ... existing options
};
// Task logic
const veryIntensiveTask = async taskDataArguments => {
// ... existing task logic
};
console.log(`Background task ${taskId} scheduled`);
if (this.configStartFunction) {
BackgroundActions.start(veryIntensiveTask, this.options);
}
}
/**
* Attempts to stop the background task. However, this does not
* seem to stop the ongoing task.
*/
static async finish() {
BackgroundActions.stop();
BackgroundTaskManager.resetInit();
console.log(`Stopping background task`);
DeviceEventEmitter.emit('stopBackgroundTask');
}
static delay = ms => new Promise(resolve => setTimeout(resolve, ms));
}
export default BackgroundTaskManager;
tried all ways but my internal hidden logic when i cann BackgroundActions.stop does not terminate ongoing task
- Lingua principale
- Java
- Stelle
- 941
- Fork
- 145
- Merge medio
- 1g 23h
- PR unite (30g)
- 3
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Rapsssito/react-native-background-actions
-
iOS CocoaPods build fails: Package.swift included in sources causes No such module 'PackageDescription'Forse già presa @dattm97 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
I’m facing a problem on iOSAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
Rapsssito/react-native-background-actions#255 · 4 commenti ·
-
enhancement help wanted
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
Rapsssito/react-native-background-actions#249 · 16 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Rapsssito/react-native-background-actions#246 · 5 commenti · 2 reazioni ·
Tutte le issue di Rapsssito/react-native-background-actions
Issue simili
-
Parse truncated verbose GC logs up to the first XML errorForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug verbose GC
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
IBM/javacore-analyser#677 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
liberation-data/fornax4j#302 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
grimmory-tools/grimmory#3297 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
SmartPack/PackageManager#186 ·
-
Area: Java feature request needs triage OS: Windows
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
actions/runner-images#15457 ·
I maintainer di solito rispondono entro 3 giorni