UI Local notification in Single App mode - ios

UILocalNotification is not coming when i have supervise my iPad in single app mode. Same code is working fine when device is in normal mode when app is in background/killed or any other state.
But after Supervise device in single app mode with same app Notifications is not coming.
In my case app will never gone in background but may be device in sleep mode.

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

why my Ios App is killed by OS in background mode?

hi i have an iOS app that runs perfectly in when i run it through Xcode on my iPhone.when i press the home button and lock the screen, the app keeps recording the data.after 1 or 2 hours when i unlock screen it is still recording data and works perfectly.but when i stop the app , unplug my phone and run the installed app directly through app icon on my iPhone it is killed by the os after a few seconds in lock screen.i have already asked similar question but couldn't find any help.if someone could download the source code and have a look at it it will be very nice of him/her.Thank you
why my Ios App is killed by OS in background mode?
The OS won't allow apps to run for long periods in the background in order to save power. There are exceptions — you can tell the OS that your app needs to run in the background for one of several reasons such as playing music in the background. There are also some facilities for waking up your app in the background to do some processing -- for example, your app can be notified when the location changes.

iOS Swift - Prevent OS from killing app in background mode?

I've created an app that takes in bluetooth data from a local device and uploads it to a database. I'd like to be able to keep doing this indefinitely when the app is pushed to the background or if the phone is put into lock/sleep mode.
I've edited Plist info to allow CoreBlueTooth and network content to be enabled while in background mode. Using this and a couple memory saving tweaks for when the app gets pushed into the background, I'm able to hit just under 4 hours of operation when the app is pushed to background and the phone is put to lock/sleep. However, after 4 hours the phone seems to automatically terminate the app completely (while being at over 80% battery life).
Is there any way to prevent iOS from terminating suspended apps and ensure that they run indefinitely (until battery runs out)?
Thanks!

Total screen unlock time calculation in iOS

For my current project, I need to calculate the total time while an iOS device is unlocked i.e. the user is working on his device. I am aware of the Darwin Notifications as available in CFNotificationCenter as specified in this Stackoverflow question. I have tested this code on my iPhone 5C. It is woking fine for foreground mode. But I am not able to receive those notification when the application is in background mode. Is it possible to receive those notification in background mode? Or is there any other way to calculate total unlocked time for a device from my app even when the application is in background mode?
As explained here. Background mode can only be used for specific purposes. If your App is not using background mode for any of those purposes (which it isn't), it will not work.
In short, it could only work on a jailbroken device.

iOS Swift background state on restart

If my app is in background/suspend mode, it will fetch data and work fine. But when I restart the iPhone the app isn't more in the background mode.
Is it possible on device start, that the app will be in the same mode (background mode) as before the restart without user activity?
Afaik, this is only possible if you specify voip as your background mode.
https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22

Resources