Solved

iOS backgrounding execution

Posted on 2014-01-08
6
442 Views
Last Modified: 2014-01-09
Hi guys,

I am developing an iOS app for iPad/iPhone for sending XMPP messages. If the user enters an area with no network coverage I want to retry sending the message when I get network connectivity. I can do this, however if the user composes a message and then hit the Home button and i'm in a  the app obviously goes into the background.

I want to be a responsible app and get into the store so know I can't piggy back onto VOIP, Music background modes so how can I still send this message out while app not in the foreground.

Can iOS wake my app up even for a short time say 30 secs every xxx minutes to let me create my XMPP session and try sending the message again? Or can I create a finite task and try for as long as possible to send my message out. Once this time limit is reached thats it and I have to wait until the app is started again?

I know there are new bg modes in iOS 7 but I want to cater for iOS 6 as well ( don't ask :D ). Do I have to use one of these new bg states for creating a long running app?

There must be something that I can do. What is the correct and best solution. Hopefully not mutually exclusive :D.

Ideally it would be iOS waking me up every so often if I have messages and me trying to send them.

Help more than welcome.
0
Comment
Question by:HackThePlanet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
ID: 39767328
In iOS 7 there is new feature - background fetch. Here you'll find everything:
Multitasking in iOS 7
Or here are two short tutorials:
iOS 7: Background Fetch
iOS 7 SDK: Working with Background Fetch

For an earlier version os iOS, I'd try to use the location manager - it will allow your app to work in the background. Or simply resend a message each time the network status is restored.
0
 

Author Comment

by:HackThePlanet
ID: 39767402
Since the application is in essence a chat application (XMPP chat) would that fall under a social networking application in Apple's eyes?

I see in the Location Manager section in developer section that it talks about "social networking".

If I have messages to send and I go into the background I suppose I could start a significant change location service. If I run past allotted time I could register for a stay of execution with a finite task.

And so on until all messages are sent. Then I would rely on Push notifications for notification of incoming messages.

Sound like a plan that would get into the app store for iOS6 and 7?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 39767480
Sounds good.
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 

Author Comment

by:HackThePlanet
ID: 39767502
Brilliant. Many thanks pgnatyuk. Found a way forward. Ciao!
0
 

Author Closing Comment

by:HackThePlanet
ID: 39767506
Fab answer. Helped distill into something that is now understandable. Cheers!
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 39768088
You are welcome
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wanted to watch videos in your computer from the bed without the need of standing up and shutting down the computer?  Is your computers operating system Windows XP, Windows Vista or Windows 7?  Do you own a iOS device? If all the answers were y…
When Apple released Swift last year, the aim was to introduce a new programming language for Cocoa and Cocoa Touch that was fast, easy and effective, like the name connotes. Apple succeeded. Swift is designed to couple with Objective-C program…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question