Phonegap background service on iOS4?

2020-02-06 03:37发布

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?

3条回答
乱世女痞
2楼-- · 2020-02-06 04:16

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.

查看更多
萌系小妹纸
3楼-- · 2020-02-06 04:17

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

查看更多
Juvenile、少年°
4楼-- · 2020-02-06 04:20

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

查看更多
登录 后发表回答