1

I'm looking to perform network tests every minute for an hour to check whether or not the user has a connection -

Ideally I'd like to get their location every minute (but not 100% necessary) and ping a server. Is this possible by either the user pressing a UIButton "start test" and then if they close the app it still runs?

Or, activate a function when the user is in a location range at a given time? (Looking to perform tests at events)

Or, possibly using a push notification to activate the function? This seems very impractical though.

My research has shown this is typically only available for VOIP or Audio apps, and background fetch based are either restricted in duration or scheduled by the device itself based on the user's behaviour, which I don't want.

Note: The app doesn't necessarily have to be released on the app store, this is just a small project so running it on a few devices will suffice.

Reficx
  • 11
  • 3
  • Please rethink. You'll kill the battery. – Seva Alekseyev Jul 08 '16 at 23:14
  • The frequency of the tests doesn't HAVE to be every minute, every 5 would suffice. Every minute just provides me with more context. Also, the file be downloaded to test availability is very small so it won't be too intensive on the device. – Reficx Jul 08 '16 at 23:20
  • In short, with the exception of certain tasks, the answer is no. See http://stackoverflow.com/q/24179921/1271826. You could use signifance change location service, but that's only triggered if you move some significant distance (i.e. new cell towers), not every x minutes. Or you could use background `NSURLSession` which will automatically perform request when connectivity is re-established. But further background requests will be treated as "discretionary" (only when connected to power and when on wifi). – Rob Jul 09 '16 at 00:04
  • If you describe the broader business problem (i.e. why you want to do this), we can probably offer better counsel. – Rob Jul 09 '16 at 00:07
  • By the way, if this is not for distribution on the store, go ahead and turn on one of the background services (eg VoIP, music, navigation, etc.). Apple would reject it, but if it's not going to be on the store, then you should be fine. This will have material impact on battery consumption, but if you're ok w that, you're fine. – Rob Jul 09 '16 at 00:14
  • Brilliant. Releasing the app would just make it easier to distribute to friends to collect more data but like I say, it's not strictly necessary. What I'm trying to do is identify the network availability in congested networks, such as stadium events or festivals. Primarily I will be running tests at football matches and identifying how event moments impact availability, e.g. if someone scores. So distributing the app would have been nice to identify positions in a stadium and network providers that are potentially more affected than others. I could use Android for the bulk of the data. – Reficx Jul 09 '16 at 09:23

0 Answers0