Comments (2)
The task should be registered at the very top level of your JS file. If you want to determine whether a button has been pressed, you'll have to use something like AsyncStorage to communicate between the main app and the background task.
from react-native-background-task.
I'm working on a new API now (PR #5) which will allow you to define the task separately from scheduling it. So while you'll still need to define the function body outside your components, you can schedule it in an onPress
as you were trying to do above.
from react-native-background-task.
Related Issues (20)
- Socket Connections HOT 2
- Failure on Android 9
- Background task not running if not debug remotely HOT 3
- Background Task is not working for android 4.4
- Release Build : Android resource linking failed HOT 2
- Nothing happened when job is finished HOT 6
- It is only working with 100% battery.
- BackgroundTask.defines the functional component using hook
- Android-job library is deprecated
- How to use it with Expo ? HOT 3
- Start first execution immediately HOT 1
- Task not triggering when app closed Android 9 / 10 HOT 4
- Min API level in V.0.2.0
- you need to call create() at least once to create the singleton HOT 1
- Cannot find module 'react-native-background-task' HOT 6
- Register Headless js HOT 1
- Background service is not working HOT 11
- Could not determine the dependencies of task ':app:mergeDebugAssets' HOT 1
- android gradle compile error
- Background task is not working in ios with react-native-fetch HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-background-task.