Schedule background jobs in React Native that run your JavaScript when your app is in the background/killed.
The result of the operation was never exposed to the JS layer, this has now been corrected by making all the functions return promises.
This update brings support to targetSDK 26. In order for that to work your background job will have to show a notification while it's executing. Specify the notificationText
and notificationTitle
when you schedule the job. See more here: https://github.com/vikeri/react-native-background-job#schedule
Thanks alexey-kuznetsov for fixing an issue where foreground jobs were not firing
This update is a breaking change.
tl;dr:
exact
makes the Job run at exact intervals (but consumes more battery).alwaysRunning
and method getAll
has been deprecatedThe library is now based on firebase-jobdispatcher instead of the built in JobScheduler. This means the library will work with Android +16 instead of previous +21. This major effort was done by @toteto. Thanks a lot!
Regrettably alwaysRunning
has been removed. Personally I don't have time to add it again on top of @toteto's changes since we are no longer using the feature at Pilloxa. But if someone wants to do this a PR is more than welcome. In theory one should only have to reimplement the Java and Javascript changes in this PR: https://github.com/vikeri/react-native-background-job/pull/20/files
Fixes #17 and #30
A new parameter, alwaysRunning is added to the schedule function and this will allow the app to run forever and prevent the system from killing it. To allow this, Android requires the app to show a notification.
Note: This will not work or at least act unexpectedly with multiple background jobs, currently only one job is supported. PR's fixing this are welcome but for our company's use-case it is not a priority.
Fixed icon issue and edge case when service is started with a null intent.
Other than that, see: https://github.com/vikeri/react-native-background-job/releases/tag/v1.1.3-0
A new parameter, alwaysRunning
is added to the schedule
function and this will allow the app to run forever and prevent the system from killing it. To allow this, Android requires the app to show a notification.
Note: This will not work or at least act unexpectedly with multiple background jobs, currently only one job is supported. PR's fixing this are welcome but for our company's use-case it is not a priority.
This is not on master yet since it is very experimental, see the README.md on the feature branch.
Install with
yarn add react-native-background-job@beta