Open Yamilquery opened 7 years ago
Have you installed and linked the react-native-background-fetch
library? As described in the installation steps:
https://github.com/jamesisaac/react-native-background-task#ios
This library doesn't provide its own native module for iOS (it just proxies the other library), so any native module error is likely related to that library not being set up correctly.
stop the react packager and build the project (react-native run-ios) after installing the module. That solved my issue
This is still an issue @jamesisaac
Could you perhaps provide some manual steps to make it work in iOs ?
There is no alternatives to use backgroundtasks elsewhere ?
@Friis1978 and others, just follow the manual steps to link the react-native-background-fetch
library here: https://github.com/transistorsoft/react-native-background-fetch/blob/master/docs/INSTALL-MANUAL-IOS.md
In my experience react-native link
doesn't do a complete job 99% of the time.
@jrnk Thank you very much, I will let you know if I can make it work, what I really want was to use it to make a tracking app run in the background, but if it can only make a task 1 time every 15 minute, I can not use it. What will you recommend me to use, if the task is for a tracking app ?
@Friis1978 for iOS you can only do that if you set the background mode to listen for location updates, audio, ble etc, see the possible background modes here: https://developer.apple.com/documentation/uikit/core_app/managing_your_app_s_life_cycle/preparing_your_app_to_run_in_the_background/about_the_background_execution_sequence#overview
For Android you can do this with HeadlessJS: https://facebook.github.io/react-native/docs/headless-js-android.html
@jrnk So I can use Background Fetch, and just enable location services from xCode, and use react-native-native-backgroundtask for android ? It seems to work well in android as it is.
@Friis1978 unfortunately not, background fetch is only for what it says, networking in the background with a minimum of 15 min. You’d have to roll your own native module I’m afraid.
@jrnk Ok thanks.
i have this problem too Native module cannot be null.
It will resolve the above error.
When I import:
import BackgroundTask from 'react-native-background-task';
I get: