Reputation: 1335
I think the title is illustrating enough. I want XMPPFramework
to work ( like a service ) in background and receive messages even when app is not in active state. I have set
xmppStream.enableBackgroundingOnSocket = YES;
But no progress here. The app goes to background, it still receives messages ( and shows notifications ) for a few seconds, but if it be inactive for a few seconds ( and idle also ( no incoming message ) ) it would no longer work in the background. I have trying logging and saw that the app is sending keep-alive packets, within a few seconds after receiving last message ( last activity ) , but if there be no activity for a few time, it stops sending keep-alives and the app wouldn't be notified and work anymore. Just in case it matters, I have set "keep alive sending interval" to 5 seconds.
I really appreciate any quick help.
Thanks a lot
Upvotes: 0
Views: 993
Reputation: 21
When you go into background the application should go xmpp offiline and program your server to send push notification when there is a message that will be a battery and data optimized way of doing it.
Upvotes: 2
Reputation: 313
Probably not related to the XMPP framework.
You want your application to run in the background. You need to mark it as background application.
Check out: http://www.raywenderlich.com/29948/backgrounding-for-ios
The closet solution is to tell iOS that your application is a VOIP application.
For testing purposes you can just set the 'Application does not run in background' to 'NO' and 'Required background modes' to 'App provides voice over IP services'.
This is done in your application plist file.
However, not sure that Apple will approve your application without really providing VOIP services.
Hope this helps, Yaron
Upvotes: 0