Comments (15)
I am facing similar problem, I was also not able to run background task in my iphone background
As per documents I have define task but it does not print "Hello from a background task" on console
Below is my version, let me know if it is related to version or device
Node Version: 6.0.0
Npm Version: 3.8.6
Xcode Version: 8.0
react Version: "16.0.0-alpha.12",
react-native Version : "0.48.3",
react-native-background-fetch Version : "^2.0.8",
react-native-background-task Version: "^0.2.1",
Device : iphone 5c
Device OS: 9.3.3
from react-native-background-task.
This worked beautifully on the iOS Simulator with Debug > Background Fetch but couldn't get it to work on a real iOS device. Would love to have this working on the device as well, as it really helped achieve the background process work on the Simulator without many hitches.
@askarhu Did it work for you? I am stuck in similar situation, it worked well with 'Simulate Background Fetch' on xCode but it doesn't seem to work with production build, I even waited for 2 days, but background fetch was never triggered.
from react-native-background-task.
Try using the "Simulate Background Fetch" feature of Xcode, documented here:
https://developer.apple.com/library/content/documentation/IDEs/Conceptual/iOS_Simulator_Guide/TestingontheiOSSimulator/TestingontheiOSSimulator.html#//apple_ref/doc/uid/TP40012848-CH4-SW5
Were you using a simulator or device? From what I understand the Simulator doesn't run background code by itself. If you were using a real device then it probably should have run after ~15 mins.
from react-native-background-task.
It was tested on device.
from react-native-background-task.
Can you try out with Simulate Background Fetch and just confirm that works first?
If it does, it's probably a sign that the task is set up properly, but Apple's algorithm is choosing not to run it (which sadly there isn't much we can do about).
Did you force close the app, rather than just leaving it running in the background? That's one which will unfortunately stop the background task occurring (until the user opens the app again), under Apple's policies.
from react-native-background-task.
The app was not closed. Home button is pressed to leave the App in Bg. I tried out the Simulate Bg Fetch in Simulator and it didn't work either. I think it may be easier if you can include a repo of working example which I can clone to have a look, since you already tested and confirmed that it is working?
I also happen to find one interesting quote when reading Nativescript.
From NativeScript Docs for "smple-ios-background-execution":
iOS doesn't allow a general-purpose background task to run forever, such a task will be suspended by the operating system after approximately 3 minutes. In some special cases your task is allowed to run longer, but you need to use UIBackgroundModes in your Info.plist file to specify the intent of your task (which automatically makes it not general-purpose).
from react-native-background-task.
the simple fetch example is not working in Android....i have follow all the steps but it is not working.Please provide a simple working example of this
from react-native-background-task.
Sure, I'll tidy up and include the example project I was using shortly, which worked on both Android and iOS.
Once that is up, @shammus672agmailcom , could you please open a new issue if you are still experiencing problems, as the debugging process is completely different for Android vs iOS.
from react-native-background-task.
I've created an example project here: https://github.com/jamesisaac/RNBackgroundTaskExample which includes step by step commits so you can see each part of the setup process.
I haven't tested this exact release of the project on iOS yet (I normally use Windows/Android so a bit of a hassle to get the environment set up), but this is almost identical to the initial code I was using to test the library across both platforms. Maybe you'll spot something you've done differently. I will test it myself shortly on iOS just to confirm everything is still working.
from react-native-background-task.
Same here
from react-native-background-task.
Here's one more thing to try, make sure Background Fetch is enabled for the project:
To support this mode, enable the Background fetch option from the Background modes section of the Capabilities tab in your Xcode project. (You can also enable this support by including the UIBackgroundModes key with the fetch value in your app’s Info.plist file.)
from react-native-background-task.
Same issue
from react-native-background-task.
Hi all, I have a similar issue. My code is working fine on android as background task but ios it is not working.
I checked all permissions and when called statusAsync() is available.
All ios background services are enabled and background updates too.
It is not working in debugging and release mode. Another behavior is about background fetch. When I force "Simulate Background Fetch" the Xcode breaks in a line with message SIGSTOP but if I force "continue" event, all will works.
Can you help me?
from react-native-background-task.
This worked beautifully on the iOS Simulator with Debug > Background Fetch but couldn't get it to work on a real iOS device. Would love to have this working on the device as well, as it really helped achieve the background process work on the Simulator without many hitches.
from react-native-background-task.
Having the same issue: it is working with the 'Simulate Background Fetch' but when built as release build it was not executed a single time during the past 12 hours...
Like @binitpatel I am also using an older version of this library (as recommended by react-native-background-task):
"react-native-background-fetch": "^2.0.8",
"react-native-background-task": "^0.2.1",
Could it be related to that? Maybe because the capability Background processing
is not set? 🤔
Was somebody here able to solve it somehow?
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.