New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
News: BackgroundTasks are coming to iOS #159
Comments
Thanks, looks interesting. This will definitely be implemented. |
It looks similar to Android’s JobScheduler. It’s a replacement for the iOS background-fetch api — fetch is disabled when this new api is implemented. |
That is amazing news. |
We waiting, thank you |
Would absolutely love this—please keep us posted! |
@Dexwell start watching this Github repo for updates. |
That would be amazing |
May I assume this implementation will find its way into flutter_background_fetch as well? |
@DartMen React Native, Cordova and Flutter all share the same native libraries ( So yes. When it works for one, it works for all. |
2 questions (thanks in advance) is possible to run background fetch for IOS while the app is terminated? |
If the OS terminated the app, fetch continues to run. If user terminates the iOS app, fetch events halt.
Yes. iOS has no such concept of "Headless", nor will it ever. |
@christocracy Do you anticipate a complicated API change for this? Most importantly, support for both iOS 13 and iOS < 13? iPhone 11 is now out, and iOS 13 is rolling out to most phones already, so I believe this is going to be come more important shortly. Lastly, I read somewhere a long time ago that background time was getting reduced from 3 minutes to 30 seconds, does this impact the library anyhow? Is this something you are aware of? |
No. background-fetch continues to work fine in iOS 13, it's just deprecated.
I have an iPhone 11 Pro for a week now and I've been testing iOS 13 beta for over a month. Background Fetch continues to operate fine.
Background fetch events have always been 30s. The new background-tasks will be added to this plugin in the future. The iOS background-fetch API isn't to go away for at least 2 years, probably much longer. |
If the app is terminated for the user the fetch events halt, thats clear. Is it allowed only for geolocalization services? Thanks in advance |
The background-geolocation plugin uses two iOS api that continue to operate in spite of app terminate / device reboot: significant location changes (SLC) and geofencing. The plugin monitors a geofence around the last known position. When the device exits that geofence, iOS relaunches your app to service the event. |
Thanks. One last question. Is possible to achieve this just using motion
or healthkit.? I mean background fetch with a terminated app?
Thanks again.
El dom., 20 de octubre de 2019 9:02 a. m., Chris Scott <
notifications@github.com> escribió:
… The plugin uses two iOS api that continue to operate in spite of app
terminate / device reboot: significant location changes (SLC) and a
geofencing. The plugin monitors a geofence around the last known position.
When the device exits that geofence, iOS relaunches your app to service the
event.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#159?email_source=notifications&email_token=AA6JPJ5F5HJOW2OIGKROMVLQPOG2BA5CNFSM4HSZOEUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBX6L7Q#issuecomment-544204286>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6JPJ7HWQ2KMTORSFEYCOTQPOG2BANCNFSM4HSZOEUA>
.
|
No. |
thanks
El dom., 20 oct. 2019 a las 22:32, Chris Scott (<notifications@github.com>)
escribió:
… No.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#159?email_source=notifications&email_token=AA6JPJ37QQTOVDED64HRX5TQPRFUBA5CNFSM4HSZOEUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBYJB5A#issuecomment-544248052>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA6JPJ4SIR4HYXOPB3A3JFDQPRFUBANCNFSM4HSZOEUA>
.
|
Hey, I'm wondering if there has been any progress with background tasks. iOS 13 has been catching up, and the new 30 seconds limit is awful. I also wonder if background tasks for iOS should even be it's own library, does it make sense to make it part of this one? |
No progress. What are you hoping that background-tasks is going to give you? It still has a 30s limit. The deprecated background-fetch api will probably work for at least 2 more years. Yes, it makes sense to be part of this one. |
Are you sure that background tasks use the same 30s limit? What's the point of it then? It's the same as requesting background time to the OS in that case. Does it just provide a better "scheduling" than background-fetch? I guess I didn't do my research yet |
It’s only an expanded scheduling system. |
Does it provide a more robust or precise scheduling? We know that background-fetch is extremely random. Still 30s run time at precise scheduled intervals is definitely better than not running at all. |
No. It’s still going to be subject to a wide grey area. |
That's awful. So iOS 13 is a loss, there's no way around it. And trying to hack it with location based events will probably just ban your app from the store. Basically, we have a large queue of items to upload to a server, and it needs to run in background, but 30s is definitely not enough, and background-fetch is not frequent enough to upload the queue efficiently. It is also not a location or music based app, so no background capabilities at all... |
DropBox lives under the same constraints. |
Also very much looking forward to the iOS 13 implementation; do you have any idea at all of an ETA? Much appreciated. |
@christocracy No pressure, just curious about the ETA on this? Thanks so much. |
I'm working on this for the past few weeks. It's almost done. |
@christocracy Thanks for providing us with this awesome library! Will we be able to execute functions in the application when the application is killed? (not running in the background) Do you have an ETA for the implementation of BackgroundTasks? |
You should watch this repo. 2.8.0 was released yesterday. You’ll want to have a good read of the README as several things changed, particularly iOS Setup. For Android, all the usual headless mechanism operates as normal. For iOS, the new method #scheduleTask only works when device is plugged into power. Maybe Apple will change this in the future, but currently, you should assume that scheduled background-tasks only fire when device is powered. |
@christocracy nice update! Would you comment a bit on the difference between using just the "fetch" event for iOS vs using Also, what would happen with Android when the above is configured? Would we end up with 1 background fetch event every X minutes and another scheduled task event every Y minutes? Lastly, how one would stop a periodic scheduled task? I see no method to do so. |
on iOS, the regular
Pretty much. On Android,
|
Thanks @christocracy . I will be giving this a try in the following weeks. For iOS, I find |
@christocracy I did see those changes; however, I have not updated yet (the above is from the previous configuration and I've assumed is related to users not allowing fetch to be turned on). It may take a few weeks until I can fully test the update, but it's good to know the changes and differences. |
Error handling will need more work. |
I tried to implement the new scheduleTask using the following example (after the config) BackgroundFetch.scheduleTask({ And receiving the following error Possible Unhandled Promise Rejection (id: 0): I am using v2.8.0. |
iOS or Android? |
iOS |
Run |
No joy. This is the line I have in my pod file I reran pod install and received this ... Same error. BTW, thank you for your assistance. :) |
I’m on the road until next week. rm your Podfile.lock and re-run pod install. It will print the pod versions being installed. |
I deleted the pod lock file and pod folder and reinstalled. It confirmed version Installing RNBackgroundFetch (2.8.0) However, I'm still receiving that same error on app startup. I'll keep working on it and let you know if I figure it out. Safe travels. |
With your app open in XCode, find RNBackgroundFetch.m: search for method |
I'm not finding that method in RNBackgroundFetch.m. It appears to be the same version that is current on github (where I cannot find it either). |
Seems I’ve pushed this out too much in a hurry. Don’t use 2.8.0 until I return. |
Just a note, as a fellow maintainer who has regretted a release (we are all human...) you can unpublish on npmjs.org, and then re-do as "next-major"beta1 or similar. Saved me repetitive bugs and user pain while I fixed up the release. Cheers Chris |
I think you have to email them now after that fiasco a few years back where that guy yanked his package that thousands of others relied upon but I’ll look into it. The recent support requests are due to necessity in bggeo auto-linking instructions to Releasing fetch as 3.0.0 won’t help in this case. I’m on the road until Monday. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open. |
Un-stale. |
This is already implemented. |
Available for following:
BackgroundTasks
Request the system to launch your app in the background to run tasks.
Overview
Use the BackgroundTasks framework to keep your app content up to date and run tasks requiring minutes to complete while your app is in the background. Longer tasks can optionally require a powered device and network connectivity.
Register launch handlers for tasks when the app launches and schedule them as required. The system will launch your app in the background and execute the tasks.
Read more:
https://developer.apple.com/documentation/backgroundtasks
The text was updated successfully, but these errors were encountered: