I have a VOIP enabled app, that has suitable codes to enable the app to run on background. The app runs fine (say for example it is able to receive calls) when its on background.
Now, when I restart the phone (with my app in question running on the background), I see after the restart the app is there on the list of apps running (this I am able to verify by double tapping the home button). However, my app is not actually running on the background, it does not receive any calls.
Once I open the app, it 'relaunches' and is now able to receive calls. Is this the expected behaviour? Or am I missing something? I need to renewable the app in background mode once the phone is restarted.
Related
I am working on a device that sends a message/signal to an iOS app via BLE. It currently works fine if the app is running in the foreground or background; however, I need the device to deliver this signal to the app when it isn’t running so it can process it, in essence, “waking it up.”
A device that seems to be doing this well is Tile (used to keep track of keys, etc.). The Tile can signal the phone even when the Tile app isn’t running, making the Tile app come up and sound an alarm. My use case isn’t the same, but I need to achieve the same behavior.
Does anyone have any pointers as to how to achieve this? The OS needs to launch/wake the app upon receiving this BLE message/signal from my device.
I am developing iOS App (iPhone/iPad) that needs be started when the device is turned on.
The app should be started on device boot.
Is this possible on iOS using Swift?
It's not possible to start your app whenever the device boots. Depending on what you need, there may be other alternatives such as running some code in the background when the app receives a Push Notification or turning on Background Fetch, though in the latter case, the system still has control on when to launch your app.
According to the documentation silent notifications are processed by the delegate application(_:didReceiveRemoteNotification:fetchCompletionHandler:) also when the app is in "Not Running" state. This behavior does not apply if the app was force-quitted by the user.
But the documentation mentions that if the device has been restarted after a force-quit, the notification will trigger again the app launch on the device.
Excerpt from the documentation:
... However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again.
Can anyone confirm this to be working (maybe with earlier iOS versions)?
My experience (using iOS 10.x) is that if the app was force-quitted the app won't be restarted even after (multiple) device reboot.
I developed a VoIP app and I read from the documentation that a VoIP app automatically restarts on phone reboot. However, DidFinishLaunchingWithOptions is not called on reboot so my connection cannot be restored.
The only way to reconnect is to start it manually it seems.
I can see the app is in memory, because it is quite quick to start when I click on it, but I thought the app should be able to restore its connection without user intervention.
Any thoughts? What am I missing? Is there another callback in AppDelegate that I missed?
The app is capable of receiving remote notifications in this state.
According to
Voip Pushkit notification will not re-launch the app if it was force-quitted and device was rebooted
this seems to work in most cases.
I have not found any official documents on this.
EDIT:
Here
https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html#//apple_ref/doc/uid/TP40015243-CH30-SW1
is the official documentation on pushkit, which describes that the app is woken up, even if it not running or in background mode.
I am developing an iOS application that communicates with a slave BLE device. I know iOS will allow my app to run in background to communicate with BLE. What my doubt is that is there any way to turn on my app if there is any BLE near by? I mean even if my app is not running can I communicate with BLE? Like location service works,i.e., if the app registered for a significant location change alert then app will get automatically turned on when there is a significant location change even if app is not running.
I have searched a lot, but couldn't find any helpful documentation. Any help is greatly appreciated..
There are a few things here and I think you have to be careful with terminology. Let's first clarify "Not running". The app has 5 modes it can be in:
Foreground: the app is "live" and on the screen
Background - unlocked: the app is "live" but not on the screen. There is either another app on the screen (front) or possibly the user is on the home screen, browsing his/her apps, etc..
Background - locked: self explanatory
Terminated by user - still on device: The user has double clicked the home button and flicked your app up (iOS7) to close it.
Terminated by system - still on device: The app has been terminated by OS because of memory pressure (other apps needed the memory space).
Obviously, if the user has deleted the app from the device then there is nothing to discuss.
In option 4, the app is still on the device but will not relaunch any of its background services (BLE, location updates, etc..) until the user relaunches the app. This is new iOS7 behavior. If the user terminated the app then he/she does not want it running.
In option 5, because the user has not terminated the app; the OS will relaunch the app background services as it receives callbacks.
In order for an app to run in the background, it requires that you add the appropriate background modes to its plist or simply click on project (top left) and go to "Capabilities" and enable "Background modes" and the appropriate background mode. In your case: "Uses Bluetooth LE Accessories".
Now you seem to be looking for "Scanning" versus connecting and exchanging data and in my experience, scanning will only work in scenarios 1 and 2 and 5. Not 3. I have tried many times to get scanning to happen while phone is locked with no luck.
Now the way, fitbit etc... work in the background is that the app, scans, discovers services and characteristics and "setup updates" between the phone and accessory while the app is in the foreground. Once this setup is done, the "value of interest" updates (heart beat, etc..) can happen between the BLE acessory and the iOS device, in the background (locked and unlocked).
Hope this helps.