react-native-background-task icon indicating copy to clipboard operation
react-native-background-task copied to clipboard

Nothing happened when job is finished

Open rafalkowalewski opened this issue 5 years ago • 6 comments

When I run my taskts and look for any console response, I see only this:

06-09 23:27:06.986 25351 25351 D BackgroundTask: Committing job schedule 06-09 23:34:37.407 25351 26893 D BackgroundTask: Job is running

and nothing happened. AsyncStorage is empty, console log were not triggered...

Any idea?

Android 9, `"dependencies": { "haversine": "^1.1.1", "lottie-react-native": "^2.6.1", "native-base": "^2.12.1", "react": "16.8.3", "react-native": "0.59.8", "react-native-background-task": "^0.2.1", "react-native-camera": "^2.9.0", "react-native-gesture-handler": "^1.2.1", "react-native-maps": "^0.24.2", "react-native-push-notification": "3.1.1", "react-native-queue": "^1.2.1", "react-navigation": "^3.11.0", "react-redux": "^7.0.3", "redux": "^4.0.1", "redux-persist": "^5.10.0", "redux-thunk": "^2.3.0" },

rafalkowalewski avatar Jun 09 '19 21:06 rafalkowalewski

the same

alexCarb avatar Jun 20 '19 18:06 alexCarb

I added this permission and it started working :) <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

rafalkowalewski avatar Jun 23 '19 13:06 rafalkowalewski

didnt work for me even after adding the permission, so the thing is that the define() method is never triggered.

rayjadore avatar Jul 08 '19 16:07 rayjadore

For those facing this issue, there is a PR that fixed this for Android 8.0+ https://github.com/jamesisaac/react-native-background-task/pull/64

qlerebours avatar Aug 30 '19 09:08 qlerebours

The fix in #64 did not solve the issue for me. I am still seeing this behavior.

03-06 13:58:27.010 27548 27641 D BackgroundTask: Initializing
03-06 13:58:27.017 27548 27548 D BackgroundTask: Setting foreground true
03-06 13:58:29.370 27548 27641 D BackgroundTask: @ReactMethod BackgroundTask.schedule
03-06 13:58:50.199 27548 27548 D BackgroundTask: Setting foreground false
03-06 13:58:50.199 27548 27548 D BackgroundTask: Committing job schedule
03-06 14:06:42.622 30274 30326 D BackgroundTask: Job is running
03-06 14:07:14.506 30515 30585 D BackgroundTask: Job is running
03-06 14:08:26.622 30623 30675 D BackgroundTask: Job is running

I call BackgroundTask.define directly in index.js on root level and BackgroundTask.schedule from inside a Compontent. The job should save a dummy value in AsyncStorage. Which it doesn't. Any ideas or any progress on that?

mathiasmoeller avatar Mar 06 '20 13:03 mathiasmoeller

any solution?

Ravi828rk avatar Jul 26 '22 11:07 Ravi828rk