GithubHelp home page GithubHelp logo

Comments (15)

binitpatel avatar binitpatel commented on May 13, 2024 4

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.

crup avatar crup commented on May 13, 2024 1

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.

jamesisaac avatar jamesisaac commented on May 13, 2024

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.

CharltonC avatar CharltonC commented on May 13, 2024

It was tested on device.

from react-native-background-task.

jamesisaac avatar jamesisaac commented on May 13, 2024

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.

CharltonC avatar CharltonC commented on May 13, 2024

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).

https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH4-SW23

from react-native-background-task.

shammus672agmailcom avatar shammus672agmailcom commented on May 13, 2024

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.

jamesisaac avatar jamesisaac commented on May 13, 2024

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.

jamesisaac avatar jamesisaac commented on May 13, 2024

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.

antonsivogrivov avatar antonsivogrivov commented on May 13, 2024

Same here

from react-native-background-task.

jamesisaac avatar jamesisaac commented on May 13, 2024

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.

mirkods avatar mirkods commented on May 13, 2024

Same issue

from react-native-background-task.

arieldll avatar arieldll commented on May 13, 2024

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.

askarhu avatar askarhu commented on May 13, 2024

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.

flogy avatar flogy commented on May 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.