iOS wake up/interrupt the device with Swift - ios

I hope this question is fit for SE, but if not please tell me where I could move it and I'll do so gladly. I'm currently building an iOS app and need to wake the device up/interrupt the current app when a "match booking request" is made, the behaviour I'm looking for is similar to what Skype uses when a call is inbound, the handset either wakes up or interrupts the current running app with the answer/end call interface.
I have never had experience with iOS, and the only solution I can think of is to poll the app and check for requests but I imagine this could be pretty intensive on power consumption, I was wondering if anyone could point me in the right direction as to what technique I could use to achieve this efficiently?

An app cannot run in the background the way you are expecting. Polling is not an option.
It looks like Skype is using Apple Push Notification Service to wake up the phone.

Related

General questions about Restcomm SDK for iOS

I am starting an application using Restroom and have a few questions about the iOS SDK.
I read through the documentation here http://documentation.telestax.com/restcomm-ios-sdk/doc/html/Classes/RCDevice.html#//api/name/listen
I have also checked out this:
https://github.com/RestComm/restcomm-ios-sdk
I see that the RCDevice class has a listen method and an unlisten method. If I want the device to always be available to receive calls should I have the listen method always going? If so, is this going to be terrible for battery life?
How do I make sure that the application is always running on the device so that it can always receive calls? I am pretty sure that iOS 10 will stop background connections unless the app is running in the foreground.
Is there a way to wake the application or open the application in the case of an incoming call? Can I use push notifications or something similar to wake/open the app?
I already replied to this question on the Restcomm Forum, but let me also answer here for better visibility by the community:
Yes, once you call unlisten() you will no longer be registered and hence receive no incoming events.
Ok, so it varies per platform. For Android since the SDK is wrapped in an Android Service even when the App leaves the foreground, the SDK continues running and you are able to receive events (we still need to check some updates on Android O though on that respect). For iOS we haven't implemented that yet so once you leave the foreground you are not able to receive any events :(. However, the plan is to move to Push Notifications functionality on both platforms soon.
Please check (2). Also, without Push Notifications, we were planning of supporting this with https://github.com/RestComm/restcomm-ios-sdk/issues/153, but also this isn't ready yet.
Best regards,
Antonis Tsakiridis

Is it possible to interact with ios devices even though app killed?

Is it possible to create an app where the message is automatically sent from one device to another when both the devices are in the same geo-location in predefined range or in the wireless points like Bluetooth?
I think there must be some way to do this. Please let me know if you have any idea about the same.
In peer-peer connection, It is not possible. When the user terminates the app everything goes with it.
But if you connect it with server, you could try to implement the behavior you are looking for with a push notification with content available, which gives you some time awake to download content in the background.

ios 8 periodic background process even after app termination

NOTE: This app I am working on is completely for my own usage and will not be on app store so please don't give answers referring that.
I want my app to do some process in background or after termination (double tap the home button and swipe the app from applications multitask) every few minutes. The process is very very light and quick so it won't drain the battery. This process shouldn't require internet connection. I have seen some answers here like and I will explain what are the problems:
VoIP. The problem with VoIP is wither it should be in background to use UIApplication.sharedApplication().setKeepAliveTimeout(..) method which doesn't work when the app is terminated or it should be connected to the internet to establish tcp connection and receive commands from sever and as mentioned before I want it to be internet independent.
Location Services. I found this excellent site with some great articles but the problem is it only works when the mobile phone is moved more than 500 meters. It depends on the location movement so when the phone is staying somewhere there will be no code execution.
Playing an silent audio loop. The problem here is if the user plays another audio (which is completely possible like music or phone call) the app will terminate!
Jailbreak Launch Daemons. I can't require jailbreak so it should be solved with a non-jailbreak solution:(.
I am free to use any kind of private-API's and there will be no restriction for that.
Thanks in advanced
I also faced with such problem, and don't find any solution.
The main problem is if user manually terminated app - in this case you can't do nothing...
Only way is:
a) use Location Services (as you mention)
b) use Push Notifications with background fetch

Working in background in iOS

I'm an android developer and I've started learning iOS development - not so long ago. I have
an android app which I want to port onto iOS. My app has
a background service which tracks user geoLocation and sends it to my server then receives response from it and then writes this response to SQLLite, please tell me how much it is possible to make this on iOS? I know that iPhone can receive location updates in background since iOS4, but what about background network connections and SQLLite? Also is it possible to send local push notifications in background?
please tell me how much it is possible to make this on iOS?
iOS is a mature OS that comes with Cocoa Touch, a huge library of classes. So, yes it is possible. And the question of possibility shouldn't be attached with the word much. Either something is possible, or something is impossible. Don't take it as how much. If it is possible, you can do it.
how about background network connections and SQLite?
Of course, this is possible. Like android, there is a rule in iOS that only your main thread can interact with the UI, and all other heavy tasks should be attached with other threads. You will use Blocks to accomplish this kind of functionality.
Also is it possible to send local push notifications in background?
Yes, it is quite possible. Have a look at the following document.
Local and Push Notification Programming Guide
Do have a look at http://developer.apple.com/, here you find a lot of documents related to the tasks you have asked in your question.

What are the criteria for determining apps with a UIBackgroundMode acceptance?

I have a requirement to develop an app that is capable of receiving pushed information from a server - which as its not possible to intercept SMSs or apple push notifications would probably have to be implemented as a poll and see what's there or similar type of thing.
However of course such a thing isn't possible if the app isn't executing in the background.
The app couldn't be considered to be musical or voip related, however its possible that it could be considered to be gps related as the pushed information would be displayed to the user based on certain triggers, and one of those triggers could be location.
Would this app with a UIBackgroundMode of gps submitted to the app store stand a good chance of being accepted?
i have been trying to do the same thing and here is what i found
iPhone - Backgrounding to poll for events
(top answer: update 2)
shows a method that should be ok, meaning your app wont be rejected for using it. the guy who posted it said it should be ok and i have asked other members who said the same (i have not verified this myself).
here is my implementation of that post
local notifications?
You don't have to use a hack for your requirements.
iOS provides a facility whereas your application is suspended but your socket is still monitored. If there's any incoming traffic on the socket, the app is woken up and handed back the control of the socket.
Advanced App Tricks
Look under the heading, "Tips for Developing a VoIP App"

Resources