Phonegap background service on iOS4?
Asked Answered
S

3

3

Can I get a phonegap application running on iOS 4 to have a background service when it's not the active app (e.g. check a url every hour and alert the user if there have been any changes)?

And if so, how?

Stria answered 1/10, 2010 at 18:16 Comment(0)
N
2

Yes, you can do that, but Apple will probably disallow it. Background running is bound to VERY specific rules. For this kind of stuff Apple invented Push Notifications (from server).

You can read the developer documentation about that.

Notepaper answered 1/10, 2010 at 18:30 Comment(0)
I
1

The best way to achieve this would be to create a plugin for PhoneGap, which runs natively on the phone. PhoneGap recommends that any heavy lifting be done by native code.

Check out the IOS documentation for background tasks, it should tell you what is allowed, and what is not.

http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

Intolerant answered 3/8, 2011 at 12:27 Comment(0)
O
0

Why don't you use onPause and onResume events. They are quite helpful.

Oology answered 3/11, 2011 at 9:45 Comment(3)
For example you can do document.addEventListener("resume", my_function, false); and there is "pause", "online" and "offline" tooInflammatory
@MagnusSmith If I use onPause event does that mean app went to background ? If so can I call a function in that which would run in background ?Submiss
I am guessing(!) the event is better described as 'beforepause' and gets run just before your app goes into hibernation.Inflammatory

© 2022 - 2024 — McMap. All rights reserved.