Avoid external display to show native iOS screen when app entering background - ios

My app has an external display when a second screen is connected. It displays the main content I want that people see while I navigate through others views. it works fine.
Is there a way to keep this external display active when app is entering background ?
I enabled background mode in Capabilities tab, I'm able to run code in background, it refreshes correctly when I enter foreground again.

AFAIK the answer is No.
As soon as your app goes to the background, it loses control of the external screen.

Related

CallKit: Launch app when screen is locked

I have implemented callkit to receive the VoIP notification.
On accept the call I am managing calls through another third party ForzenMountain which has my custom screen to show the status of calls.
1) When screen is not locked: Call comes then it shows two button. On accept it goes into the app itself and I can manage all.
Problem:
2) When screen is locked: It show another transition which has multiple option like (speaker/keypad/mute/addcall) rather than to go into app.
I need to land on my app even my device is locked (if passcode enable then ask to enter it) so that I can manage FM and my custom calls screen.
Unfortunately, there's no way to go directly into your app if the phone is locked. The system will only display the native CallKit UI and from there you can tap on the bottom right button to go into your app.

iOS Multitask App Switcher Custom Image

im developing an iOS App and i would like it to behave like PayPal when the user double taps the home button.
For those who dont know the PayPal app displays a custom image when the app is displayed on the multitask switcher but it doesnt when a notification arrives or when the user pulls the notifications bar.
My issue comes when implementing this, im using the event applicationWillResignActive to display my custom image (as applicationEnteredBackground is not called for this). But this method is called on events on which i dont want the app to display the image (such as notifications, calls, pulling the top bar, etc).
Is there any way of setting this image only when the home button is double tapped?
Thank you!
From what I see, PayPal doesn't cover the viewport with a custom image immediately – when I double tap the Home button, it remains rendered normally until I do something else – but most probably on applicationDidEnterBackground:. After switching to Home screen or another application, the PayPal preview becomes covered.
On the other hand, my mobile banking application does that immediately when applicationWillResignActive: is triggered.
These are AFAIK the only two approaches you can achieve.

iOS app printing while running in the background

I have an iOS app that automatically prints a receipt to a thermal receipt printer when an order comes in and works great. However, if the app is in the background, it does not print. Is it possible to allow it to print while running in the background?
There are only a few occasions you are allowed to run certain tasks in the background. See the Apple documentation: https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW20
For example: playing audio, fetching the user location, sending notification or certain data from network in the background is allowed. Running your own logic during a background service is, as far as I understood, not allowed (like running it one hour after your app is gone to sleep/background mode).
The only thing that is perhaps an option, is to utilize the time your app has to finish an task after the home button is pressed. There is a timelimit however of 10 or 15 minutes.
I don't know if this is suitable for your situation?
See this stackoverflow question: iOS application executing tasks in background
And this particular piece of code to run the task in the background: https://stackoverflow.com/a/11809211/2740112
Another option is to use Guided Access, which is introduced since iOS6.
With it, you can prevent exiting the app. It's only usefull when using only the app on the device that needs to be used.
Information below from http://www.assistiveware.com/support/faq/page/136:
To turn on Guided Access, do the following:
Go to the Settings app on your device's home screen.
Tap General.
Tap Accessibility.
Under the Learning section (scroll down if necessary), tap Guided Access.
Toggle Guided Access to ON.
Tap Set Passcode and enter a four digit passcode. You will be prompted to enter it again.
(Optional) Toggle Enable Screen Sleep to ON if you want to be able to put your device to sleep with the Power button, otherwise the Power button will be disabled.
To start Guided Access for an app and prevent it from being exited, do the following:
Open the app that you want to lock in.
Quickly press your device's Home button three times to bring up the Guided Access menu.
Tap the Start button in the top right corner of the screen to activate Guided Access. A message stating "Guided Access Started" will briefly appear.
To end Guided Access for an app so it can be exited, do the following:
Quickly press your device's Home button three times to bring up the Guided Access menu.
Enter your four digit passcode when prompted.
Tap the End button in the top left corner of the screen to end Guided Access. A message stating "Guided Access Ended" will briefly appear.
Here's the knowledgebase article of Apple: http://support.apple.com/kb/ht5509

Detect if home button is pressed while the app is running in the background

I need a way for my app to know if the home button is pressed, while the app is running in the background. If the home button is pressed, something is gonna be added to a list inside the app. Is that possible somehow?
If your app is in the background, your app wont receive any updates. Furthermore, there isn't any way to hook into the home button click even if your app is in the foreground.
Perhaps there is a private api way to handle this, but your app certainly won't be able to both achieve this goal and be in the Apple App Store. Sorry!
In case you wanted some idea why Apple doesn't allow this, it's because they don't want the home button switch's default behavior to be altered. See this:
10.5 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, will be rejected

Prevent application from entering background, requiring a code to close app

I would like to add functionality to my iPad app such that, when the home button is pressed and my app is about to enter the background, a message box pops up requesting a code. Only if the correct code is entered will the application go into the background, otherwise the app will not close.
Is this possible?
Short answer, no it's not possible.

Resources