Closed aymanMFD closed 4 months ago
When I try to start a service by pressing a button, the warning Cannot read property 'start' of null. pops up.
Cannot read property 'start' of null.
This is my code
const veryIntensiveTask = async (taskDataArguments) => { // Example of an infinite loop task console.log("Starting") const { delay } = taskDataArguments; await new Promise( async (resolve) => { for (let i = 0; BackgroundService.isRunning(); i++) { console.log(i); await sleep(delay); } }); }; const options = { taskName: 'Example', taskTitle: 'ExampleTask title', taskDesc: 'ExampleTask description', taskIcon: { name: 'appstore', type: 'drawable', }, color: '#ff00ff', linkingURI: 'yourSchemeHere://chat/jane', // See Deep Linking for more info parameters: { delay: 1000, }, };
const startBackgroundService = async () => { await BackgroundService.start(veryIntensiveTask, options); await BackgroundService.updateNotification({taskDesc: "This is the counter"}) }; // More code <TouchableOpacity onPress={startBackgroundService}> <Text>Start BackgroundService</Text> </TouchableOpacity>
The same here
Duplicate of #199
When I try to start a service by pressing a button, the warning
Cannot read property 'start' of null.
pops up.This is my code