-
Notifications
You must be signed in to change notification settings - Fork 977
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
feat: Really background tasks #3032
Comments
Issues tagged with feature request are closed but tracked for👍 reactions to gauge interest. |
I'm a bit confused. I arrived at this issue from the Capacitor 3 upgrade guide, which states "subscribe to #3032 for updates." Is this the correct issue? |
I also arrived at this issue from the Capacitor 3 upgrade guide, I'm concerned that the plugin has been removed, I do not agree that this this feature request relates to the existing capacitor 2 functionality. |
Same here, I came here from the Capacitor 3 upgrade guide. Unfortunately, the removal of this plugin blocks me from upgrading unless I find a way how to do the same thing with a different, non-capacitor plugin. |
I also need the plugin to work in the background for my app, my app is for inventory management and needs to receive events via websocket even in the background. |
My app also uses the Background Task plugin. To be able to migrate to Capacitor 3, I've created a Background Task plugin for Capacitor 3. It has the same limitations as the Capacitor 2 plugin. |
Very nice, would you consider adding it to the community plugins? |
Yes |
@robingenz As someone who is completely new to capacitor, what are the limitations of your plugin? I see under quirks it mentions |
@robingenz it means that I cannot use it now (I want to support both iOS and Android). I'll postpone the capacitor upgrade then and, if I have some time in the future, I may try to help to add the android support (but not now, sorry, too many things to solve ATM, I'm feeling a bit overwhelmed). |
As I said above, it has the same limitations as the Capacitor 2 plugin. |
I just wanted to point out, as a side note, that there's a plugin It seems to be up-to-date, but has fairly limited functionality: EDIT: Both are free and distributed under MIT License |
That's a good solution for the original issue I don't think it helps those of us arriving at this issue from the link on Ionic's release notes for capacitor 3 where this issue is conflated with the removal of the Capacitor plugin (background task) which provided a little time to complete tasks on closing the app. |
I'm coming from the v2 -> v3 upgrade guide, so I'll explore some of the options here. A real background plugin would be amazing, I think. I've also submitted a SO question about how to do long-running uploads with Ionic and Capacitor, which is why I'm using the BackgroundTask plugin. Is this plugin even truly needed for that, or is there a different/better approach? |
Hi @robingenz
I installed and used it but my task doesn't work when I close the application, it works only when I minimize it (after pressing Home button for example).
I want to send some local notifications even when the app is closed/removed from the multitasking bar. Could you please tell me what am I doing wrong? |
It would really be good to have this - without this building a whole category of apps (scheduling, meeting, timers, event-based apps) that leverage local notifications are not really possible |
Performing background tasks would be great! We are currently working on an over-the-air update feature using bluetooth low energy. This process takes 5 minutes and should not be stopped when the app is not active anymore. |
I wanted to migrate from Cordova to Capacitor, but background tasks (specifically background upload) is crucial to my project. |
Does anyone know if there's a workaround at this time? I need to handle 5MB photo uploads (on Android), and I feel like I won't be able to do it without background tasks |
The biggest limitation is on the WebView side - when you minimize app all timers begin to emit with minimal 1 second interval. So all logic witch depends on setTimeout and setInterval (mostly all async logic) begins to work wrong. Also after 5 minutes all timers stop to emit. And this can not be fixed with js code or native plugins. So if you really need to do something in the background - you need to write native code and work with native background limitations. |
@notflip 5 mb should be ~13 seconds on 3G (3 mbit). I'd just show a progress bar. |
@sandstrom That's what I'm going to do indeed, I'm going to see how low I can turn the Capacitor Camera quality property until it looks good. |
Do you know if Background Tasks are 100% necessary if I need to play audio natively when the phone is locked or when they leave the app? |
Please integrate this feature. Currently in need of it to deliver local notifications after users close the application/on boot. It's beyond a headache working with other solutions which don't have the best documentation or issues sections, especially when alert settings are kinda crucial for certain applications. |
For anyone stumbling across this issue, there are currently the following Capacitor plugins that can be combined:
I will soon publish a blog post with a guide on how to best combine which plugins to run Background Tasks on Android and iOS. |
A few more plugins that have some helpful hints:
The This works by sending a "VISIBLE" state to the WebView a few seconds after the app is pushed to the background, which seems to restart all the timers back to their normal interval. With this technique, I've been able to keep an app reliably executing in the background (at least until doze mode kicks in) on a variety of phones. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
Feature Request
Hello!
The current background task is limited only run tasks in IOS for short time I understand the limitations but how the timer apps?
But in IOS my timer stops in Cordova I use the background-mode-plugin and works but with Capacitor what is the better approach?
I tried to use cordova-background-mode plugin in IOS with Cordova works but with the same code in Capacitor doesn't work
Capacitor App: https://github.com/nicobytes/capacitor-background
Cordova App: https://github.com/nicobytes/cordova-background
There is the branch https://github.com/ionic-team/capacitor/tree/wip-background-task but is inactive but has a method RegisterScript, that idea is possible?
Is there any native API for Background Tasks in IOS?
My context
What is the better approach for background task for a timer, I'm making an app for sleep routines with sounds when the user wants to start to sleep start a sequence.
I have a timer for each phase when the time is up should continue with the next phase automatically with a new sound.
The text was updated successfully, but these errors were encountered: