So I'm asking all of you PhoneGap/Cordova/... experts, I have an upcoming project in which I'm targeting both iOS and Android and I have to make a decision whether to do it Cross-Platform or native.
However, this app has to run in background at some point of its life cycle. I've found these plugins but some people are saying it's not working:
The question is can I do backgrounding with Crodova technologies ? If yes which is the best plugin ?
Please help. Thanks.
You have to keep in mind that Cordova apps run in a webview in the main (GUI) thread of your app. In practical terms, your app will run minimized only until the OS decides it wants to halt it for whatever reason (typically to preserve RAM and/or battery).
For Android applications, you can create your own Cordova plugin that implements a background service. Instead of doing this from scratch, you can use Red-Folder/bgs-core as a starting point. You'll have to write the logic of your bg service using java and the Android SDK.
For iOS applications it's trickier. Apple only allows background code for a number of use cases: Audio playback, GPS tracking, others. The cordova-plugin-background-mode fakes background Audio playback to keep the app alive but it won't be accepted to the app store. My (very superficial) testing on iOS showed that when using the cordova-plugin-background-mode and actually playing background audio, my Javascript callbacks inside my app would be called erratically (called late and sometimes not called at all).
For my use case, I ended up implementing an Android service as mentioned and an iOS plugin that uses Apple's AVQueuePlayer to play background audio and video while the app is minimized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With