iOS Background task to check for server availability - ios

This is my very first post on SO!
I'm a beginner iOS developer and I'm looking for a solution for my Swift app.
Is there any way to implement functionality to ask for a server availibilty on a regular basis (e.g. every 5 min) even when the app is not running. That would only require a simple http request so the app would work as a monitoring tool for a specific server. I tried using Background Fetch but it doesn't seem reliable enough since I can't force it to run every 5 minutes.
Is it possible to achieve that in iOS or maybe there are some better ways to implement such monitoring tool?
EDIT:
To partly answer my question I've found this solution that requires the abuse of Apple policy regarding multitasking:
http://yifan.lu/2013/12/17/unlimited-backgrounding-on-ios/
It requires the use of Audio / AirPlay Background Mode, but I can imagine that Apple won't accept such app in the AppStore. Is there any 100% proper way to achieve my goal?

Related

Relaying data between iOS devices with app in background

This might be asking for the moon but here goes...
Is it possible to have an iOS app receive data and then forward it all while running in the background?
We're a restaurant currently using an ordering system that uses a main iPad as the till, with a second iPad in the kitchen to receive orders, and another third iPad used by the servers to take orders. Orders are sent to the main till which relays orders to the kitchen.
Works great... Unless someone switches app on the main till iPad to our other (necessary) hosting app, then all hell breaks loose and all orders stop getting sent.
Developer (small team) has told us it's impossible to solve but I have done some digging into recent Apple APIs that allow simple tasks to run in the background and have seen a few promising options, or perhaps it's possible via the External Accessory Framework, or even syncing via iCloud? A question for the more knowledgable than me, but is there currently a workaround to solve this that I could suggest or are they right in that it's currently impossible in iOS?
Yes there are ways to have an app in the background receive data, generally using either:
beginBackgroundTaskWithName:expirationHandler:
or
beginBackgroundTaskWithExpirationHandler:
Take a look at the Background Execution section in the documentation for more info...

Tracking device useage on iOS

I've been using this app called Moment that tracks how much time I spend on my device every day. I think it's very cool, and at the same time am very curious how it works. I don't have tons of mobile development experience, as I've mainly built web apps, but I'm curious how this kind of functionality could be achieved.
I did a few quick Google searches and found that iOS does have some support for background task execution. The functionality lies in four categories:
Play audio
Receive location updates
Perform finite-length tasks
Background fetch
It looks like I can't do anything tricky using audio callbacks, as Apple will reject the app, but I'm wondering if I can do something with (3).
They do it using Custom Profiles.

Data push from server to iOS device

I want to send updates from server to iOS device without using APNS when application is not active (not even running in background). Any ideas regarding how can I accomplish that? One thing I want to mention is that it's not a web application to which I want to send updates. Is there any free API that could be used to meet my requirement?
Your help will be greatly appreciated. Thanks.
No, there is no such service. If there was one, it would be a service provided by Apple as it would need to run on the system level.
If the app is still running in the background (i.e. not killed), you could use background-app refresh introduced in iOS7 (c.f. this post for an example).

Daily check in Trigger.io mobile application

I want to write a feature in my app that checks local data daily (at a specified time eg. 12:00pm), and alert if needed. Really, I want something kind of like setTimeout() in Node.js.
Does Trigger.io's API give me a way to 'background' a small check, or fire an event at a specific time? Something via the OS,so that the app doesn't have to be running all the time?
I've searched through the API, but might be using the wrong terminology (as a non-mobile dev).
This isn't something currently supported, mainly because its difficult to provide a consistent experience across Android and iOS.
A common solution to this kind of problem is to have the check performed on a remote server, then use a push notification to notify the user if required. (see http://docs.trigger.io/en/v1.4/partners/parse.html#partner-parse)
The reason doing this on the device is difficult is that on iOS you cannot just run code in the background, it is possible to send a notification to the user at a specific time but this notification has to be set in advance.

iOS 4 Multitasking - Daemon Process

How to create an app that functions like demon process at the background?
Is this possible?
Generally not. Apps can't fork processes, the only thing you can do is ask for some time (max 10 minutes) to resume tasks after your app was send to background. For specific use cases (audio playing, location tracking, VOIP) there are well defined exceptions to this rule.
No. Apple only allows specific hooks for background functions, but you cannot - without jailbreaking the device - run anything in the background "generically".
Better think of Multitasking as fast-app-switching with some extras. I recently did a little writeup of this on my blog trying to shed some light on a topic in the Apple discussion forums.
Maybe you find it useful to understand more of the backgrounds. It can be found here: http://www.danielschneller.com/2010/11/ios-421-battery-drain-on-ipad.html

Resources