Do iPhones get sent to home screen after long periods of inactivity? - ios

Usually, if one locks an iPhone while on a certain app, then unlocks it, that same app will be on the screen.
I've heard that after long periods of inactivity, (in the locked screen state), when the phone unlocks it doesn't show the app that is currently open, rather sends it to the background and goes to the home screen.
Is this true?

The App may be terminated in the background, but will be reopened if the user unlocks his device. This does not happen to Apps that play audio.
You may want to check about background execution.

Related

Launch app in background when BLE device is in range

I'm making an iOS app to support a Bluetooth LE device. First time the app launches, we pair, but after that I want to communicate with the device whenever it is in range. Using background modes, this works fine for when the app is launched and goes into background and the screen is turned off. But, when the phone is rebooted, the app needs to be relaunched before it will be able to detect the device.
Is there any way to have the app launch in the background whenever the BLE device that it is paired to comes nearby?
In case of user forcibly kills the app by double clicking on home button and swipe out, it will not be relaunched until the user launches it again.
Coming to your case when Device is rebooted - Yes, you can configure State Preservation and Restoration to relaunch the app when user has not killed it forcibly before rebooting.
( Note: If the device requires a passcode to unlock, apps will not be relaunched until the device is unlocked for the first time after a restart )
Also, it is important to keep in mind that the app will be relaunched and restored if and only if it is pending on a specific Bluetooth event or action (like scanning, connecting, or a subscribed notification characteristic), and this event has occurred.
For more info:
Conditions Under Which Bluetooth State Restoration Will Relaunch An App

Are terminated apps removed from the app switcher?

If an app is suspended and the system decides to terminate it, is it removed from the app switcher or does the app switcher retain a snap shot of the app as if its still suspended?
It will stay there until the user swipes up to kill it. When the user returns to the snapshot of a killed app it will simply relaunch.
Apps terminated by iOS are not (normally) removed from the app switcher. However, if the user swipes up on the app to remove it from the app switcher, that app is (normally) also terminated.
I say "normally" because Apple does not document this behavior and may be subject to future changes. But this is how the app switcher currently appears to behave.

How to keep Chrome Cast running in background iOS?

I have a simple question when you go to home screen of iPhone and do not quit the application than the chrome Cast device stops playing the video on screen how can I keep playback alive while the application is running in background.
If you have a video app and it is running in a cast device, you would want the following behavior:
if user "explicitly" disconnects a device (through the cast menu), then receiver should look at the connected devices and see if there is any "other" connected device. If there is none, it should stop the application on the cast device. If, however, it finds another connected device, it should not stop the app.
If user doesn't explicitly disconnect but device gets disconnected since the app goes into background, or phone goes out of wifi range, or it battery dies, or ..., then receiver should not stop the app and should let it run, even if there is no other connected sender.
If you follow these two in the design of your app and your receiver, then you shouldn't have any issue when your phone goes to sleep or your app goes to background. Do you still see an issue given the above?

UIApplicationExitsOnSuspend and screen refresh

I have an app that has the UIApplicationExitsOnSuspend info list property set to TRUE.
And now I am noticing a curious issue.
I start up the app and let it run on my phone and do not touch my phone. Eventually the phone screen goes dark and the phone goes into standby mode. When I wake the phone up, what I see is a screenshot of the last screen displayed on the app. (This seems according to spec, since the Apple documentation says that in the process of moving an app to the background, ios takes a picture of the app and uses that for transitions when the app comes back to life). If I double click on the home button to see running apps, I do not see an instance of the app running. (again, working as intended since UIApplicationExitsOnSuspend is set to true).
My question is, how do I make sure that when the phone wakes up, it comes back to the default home screen and not the picture of the app ? Clearly the app is not running on waking up, so there is nothing I can do from within the app that will refresh the screen. I could try to exit when the app is going to background, but then apple guidelines say, never exit programatically!!.
Any ideas ?
You misunderstand what is happening. If you enable UIApplicationExitsOnSuspend, this means your app will terminate when normally the app would go to the background. If you run your app then let the phone sit idle until the screen goes dark, your app is still in the foreground so it is not terminated. When a device goes into standby mode, the current app is still the current app. When you wake the device, you are not looking at snapshot of your app, you are looking at your running app. Double-tapping the Home button at this point doesn't show your app because your app is the currently running app.
Your app will be terminated if you return to the home screen or switch to another app. But it will not terminate just because the device went into standby mode.
If you want your app to return to its main screen when the device is woken up, then you need to put code in the UIApplicationDelegate applicationDidBecomeActive: method to reset your user interface.

iOS - Relevance of the clock appearing when resuming?

I'm working on a long-standing, fairly-complex iOS Cocoa app, and I'm trying to fix performance when resuming from the inactive (say, locking the device). The problem appears on all versions of the iPhone (we support back to the 3G).
The steps are:
Run the app.
Lock the screen with the sleep/wake button (lock
button).
Resume the app. The app appears on the same view that it
showed before, but it's non-responsive. Also, in the OS bar, the
carrier, signal, battery, and location icons appear, but the clock
is missing.
After about a second, the clock comes back, and at about
the same time, my app is responsive.
I would say that it's an iOS thing, but most apps don't take nearly that long to come back, including to show the clock.
What is the significance of the rendering of the clock in the OS task bar when resuming from sleep? I need to know what period of time this represents (after this event/action/delegate/etc, but before another one) so I can narrow down the point of the code to examine.
When I debug with Xcode, this doesn't happen. It also doesn't happen in the simulator, ever.
Thanks!

Resources