Closed JuanCAlpizar closed 8 years ago
I will check it ASAP
On Fri, May 23, 2014 at 1:00 AM, JuanCAlpizar notifications@github.comwrote:
Hello, I have a phonegap application that needs to check for notifications every amount of X minutes based on user preferences, so I thought about using this plugin to make it.
My problem is that LockBackgroundTime doesn't seems to run infinitely, I put a console log every second to check it out, and after around 3 minutes the console stops printing.
Same happens when I use window.plugins.BackgroundJS.SetBackgroundSeconds(310, function(){}, function(msg){console.log(msg);}); once it gets around 180 seconds the console stops printing and the conditions inside never happen while the application is on the background.
I'm testing on an iPhone 4S with iOS 7.1
am I doing something wrong or is this a bug?
— Reply to this email directly or view it on GitHubhttps://github.com/hazemhagrass/phonegap-background/issues/5 .
Thanks a lot Hazem Mohammed Hagrass
Hello, I'm experiencing the same problem. Is there please any fix for this? I found this plugin the best out of other available for background mode, except this one bug. Thank you very much
There's no possible way that ios7x will let an app run indefinitely in the background. After 3 minutes, ios is going to suspend your app.
I see, thanks for info! so what would be the best way to go then, if I want an app that notifies the user ever 30 minutes for example? is there any native of phonegap based approach to perform this?
I'm sorry I don't know anything about iOS programming, so I'd appreciate some hints about the way to go.
Thank a lot for your response. I was also checking another plugin for background mode - https://github.com/katzer/cordova-plugin-background-mode . There seems to be a different problem - the app runs in the background mode for infinite time. It is not possible to stop the background mode when the app is not in the foreground.
Thanks for your help
I'd send a silent Push notification from your server to device every 30min with Urban Airship. You can use my background-notification plugin to receive the push and call a js callback. Ios will give your app exactly 30s of execution time before it suspends again.
https://github.com/christocracy/cordova-plugin-background-notification
On Wednesday, August 6, 2014, JuanCAlpizar notifications@github.com wrote:
I see, thanks for info! so what would be the best way to go then, if I want an app that notifies the user ever 30 minutes for example? is there any native of phonegap based approach to perform this?
I'm sorry I don't know anything about iOS programming, so I'd appreciate some hints about the way to go.
— Reply to this email directly or view it on GitHub https://github.com/hazemhagrass/phonegap-background/issues/5#issuecomment-51345086 .
Snet from Gmail Mobile
I wouldn't background-mode plugin -- It turns on full power GPS to provide background running, killing the user's battery. Your user's will hate you and Apple will deny your app if you're not doing a location-based app.
On Wednesday, August 6, 2014, jojo69256 notifications@github.com wrote:
Thank a lot for your response. I was also checking another plugin for background mode - https://github.com/katzer/cordova-plugin-background-mode . There seems to be a different problem - the app runs in the background mode for infinite time. It is not possible to stop the background mode when the app is not in the foreground.
Thanks for your help
— Reply to this email directly or view it on GitHub https://github.com/hazemhagrass/phonegap-background/issues/5#issuecomment-51346653 .
Snet from Gmail Mobile
I agree with the GPS point, I'll check the silent push notification plugin, thanks!
Thnks
It’s not a “silent push notification plugin”, it’s a “notification-plugin which happens to run in the background”.
A silent push is merely a Push notification with only a JSON payload — no text message, so no beep or popup message to the user.
On Wed, Aug 6, 2014 at 12:17 PM, JuanCAlpizar notifications@github.com wrote:
I agree with the GPS point, I'll check the silent push notification plugin, thanks!
— Reply to this email directly or view it on GitHub https://github.com/hazemhagrass/phonegap-background/issues/5#issuecomment-51358683 .
Chris Scott Transistor Software http://www.transistorsoft.com
Fair enough, sorry for misunderstanding, I'll check it out as soon as I'm free to go back to the project I was working on, thanks :)
@JuanCAlpizar Did you solve this problem? Is it possible to run a background task on iOS to check server for a long time?
This restriction is not a problem -- it's s protection against developers killing the user's battery.
There is NO way to keep the CPU spinning in background on iOS unless you declare a UIBackgroundMode, such as "location" or "audio".
If you do declare a UIBackgroundMode, you better be making an app related to to that mode (eg if you declare "audio" and you're not making something like a music player, you're screwed; Apple will reject you). Or if you declare the "location" mode, like my plugin cordova-background-geolocation, you better be making a fleet-tracking/jogging app or something. https://github.com/transistorsoft/cordova-background-geolocation-lt
The solution is to have your server do the polling, sending silent push requests to devices.
@bottasergio as @christocracy said, it's a system limitation, why it does it it's a different topic (no way it's a system protection, just take a look at project Doze from Google, apps can always run in background and the system regulates this lol but they're never killed and even before Doze I had phones with 5.5 screen on time hours and 24 hours per charge cycle) in the end I went for the silent push notifications.
I'm closing this because there's basically nothing the developer can do about it unless iOS change its policy on the matter.
Cheers
What about https://github.com/edewit/cordova-background-plugin that implements "Background fetch" as Apple says on https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html ... "Background fetch ... The app regularly downloads and processes small amounts of content from the network." ??
cordova-background-plugin
won't do it. I made a background-fetch implementation too.
iOS background-fetch is nice, bit it will only awaken your app about every 15min (during primetime hours, less often when you're presumed to be sleeping), providing your app exactly 30s of background-running. Once the 30s elapses, your app is back to sleep.
@christocracy During the 30 seconds, is it possible to retrieve data from a web server and show a notification to the user if there is new info?
And just in case anyone ever gets tempted to use cordova-plugin-background-mode
, just search its issues for "rejection" -- nothing but tears.
100% guaranteed Apple rejection
@bottasergio That's exactly the purpose. You can do whatever you wish.
If you had a sports app, for example, you'd refresh the scores every 15min in background so that when user opens the app again, it's relatively fresh data.
@christocracy which plugin you recommend to use to notify user that new info is available? I have to use it before " Fetcher.finish(); " right?
Have you tried onesignal.com ? Excellent service and support. Works on iOs and Android with no problem! And it is free!
How about this?
https://apps.ionic.io/landing/push
On Monday, November 9, 2015, bottasergio notifications@github.com wrote:
Have you tried onesignal.com ? Excellent service and support. Works on iOs and Android with no problem! And it is free!
— Reply to this email directly or view it on GitHub https://github.com/hazemhagrass/phonegap-background/issues/5#issuecomment-155220015 .
Snet form Gmail Mobile
Bad beginning ... "500: Server Error . We broke something! Our team has been notified and we will be fixing the issue shortly." when registering!
Hello, I have a phonegap application that needs to check for notifications every amount of X minutes based on user preferences, so I thought about using this plugin to make it.
My problem is that
LockBackgroundTime
doesn't seems to run infinitely, I put a console log every second to check it out, and after around 3 minutes the console stops printing.Same happens when I use
window.plugins.BackgroundJS.SetBackgroundSeconds(310, function(){}, function(msg){console.log(msg);});
once it gets around 180 seconds the console stops printing and the conditions inside never happens while the application is on the background.I'm testing on an iPhone 4S with iOS 7.1
am I doing something wrong or is this a bug?